Created
December 16, 2014 04:36
-
-
Save scratchyourbrain/16e8d898db180e3f4b0d to your computer and use it in GitHub Desktop.
C Program to Check Whether a Number is Positive or Negative or Zero.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
float num; | |
printf("Enter a number: "); | |
scanf("%f",&num); | |
if (num<0) /* Checking whether num is less than 0*/ | |
printf("%.2f is negative.",num); | |
else if (num>0) /* Checking whether num is greater than zero*/ | |
printf("%.2f is positive.",num); | |
else | |
printf("You entered zero."); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment