/*gowrikausalya.blogspot.com*/
/*c-program to find whether the given number is odd or even */
#include<stdio.h>#include<conio.h>
int main()
{
int num;
printf("Enter the number:\n");
scanf("%d",&num);
/*find the modulus of a number*/
if(num % 2== 1)
printf("The number is odd");
else
printf("The number is even");
getch();
}
the program displays the following ouptut:-
Enter the number:
24
The number is even
Enter the number:
13
The number is odd
output screen for easy understanding:-
![]() |
output screen for even number |
![]() |
output screen for odd number verification |
Nice article . you can use & operator for checking even or odd any number reference check even or odd without modulo
ReplyDelete