Write a program in 'C' to test whether the given integer is even or odd and to print message accordingly.(Using if...........else statement.)
HP 2009M 20-Inch HD LCD Monitor
#include< #include< #include< main() { int n; printf("Enter any integer\n"); scanf("%d", &n); if(n % 2 = = 0) printf("The integer %d is even \n", n); else printf("The integer %d is odd \n", n); return(0); } |
---|
For eg :-
Output :-
Enter any integer
25
The integer 25 is odd
Output :-
Enter any integer
10
The integer 10 is even
0 comments:
Post a Comment