rootUser

Check postive negative

May 26th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* C programme to check if a number is positive or not */
  2. #include<stdio.h>
  3. int main(void)
  4. {
  5.     float a;
  6.     printf("enter a number to check whether it is positive or not\n");
  7.     scanf("%f",&a);
  8.     if(a>0)
  9.     {
  10.         printf("positive\n");
  11.     }
  12.     else if(a<0)
  13.     {
  14.         printf("negative\n");
  15.     }
  16.     else
  17.     {
  18.         printf("zero\n");
  19.     }
  20.     return 0;
  21. }
Add Comment
Please, Sign In to add comment