sahajjain01

E2.Input a no. and check if it's positive, negative or zero.

Sep 2nd, 2015
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. //Program to input a number and check if it's positive, negative or zero.
  2. #include<stdio.h>
  3. #include<conio.h>
  4.  
  5. void main()
  6. {
  7.     int number;
  8.  
  9.     clrscr();
  10.  
  11.     printf("Enter a number: ");
  12.     scanf("%d", &number);
  13.  
  14.     if(number > 0)
  15.         printf("The number %d is positive.", number);
  16.     else if(number < 0)
  17.         printf("The number %d is negative.", number);
  18.     else
  19.         printf("The numebr %d is zero.", number);
  20.  
  21.     getch();
  22. }
Advertisement
Add Comment
Please, Sign In to add comment