Write a program in 'C' to input an integer and to print whether it is positive, negative or zero.(Using if.............else statement)
#include< #include< #include< main() { int a; clrscr( ); printf("Enter any integer\n"); scanf("%d", &a); if (a > 0) printf("The integer is positive\n"); else if (a < 0) printf("The integer is negative\n"); else printf("The integer is Zero\n"); return(0); } |
---|
For eg :-
Output :-
Enter any integer
25
The integer is positive
Output :-
Enter any integer
-32
The integer is negative
Output :-
Enter any integer
0
The integer is Zero
0 comments:
Post a Comment