In this program, you will find whether numbers entered by users are even or odd. if the number is even, you will print the number is even and if the number is odd, print the number is odd.
Even numbers are integers that are exactly divisible by 2 and have no remainder. for Example 2, 10. -16.
#include<stdio.h>
int main()
{
int a;
printf("\n enter the number:");
scanf("%d",&a);
if(a%2==0)
{
printf(" %d is even number",a);
}
else
{
printf("%d is odd number",a);
}
return 0;
}
enter the number:15 15 is odd number enter the number:10 10 is even number
a
.if
a part will get executed and it will print that the number is even.else
part will get executed and it will print, the number is odd.