Learn about Even Number Program in C in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.
Contents
Even Number Program in C
Source code:
#include<stdio.h>
int main()
{
int number;
printf("Enter number: ");
scanf("%d",&number);
if(number%2 == 0)
printf("%d is an even number \n", number);
else
printf("%d is not an even number \n", number);
return 0;
}
Output:
Enter number: 4
4 is an even number
Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.
Similar Codes :
Simple Calculator program in C
Check Leap Year Using a switch case statement