Skip to content
Home » Even odd program in C using if-else

Even odd program in C using if-else

Learn about Even odd program in C using if-else in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.

Even odd program in C using if-else

If the number exactly divides 2 then it is even number. If it gives remainder 1 then it is Odd number.

Program:

#include<stdio.h>
int main()
{
  int number;

  printf("Enter a number: ");
  scanf("%d",&number);

  if(number%2==0)
   printf("%d is Even Number\n",number);
  else
   printf("%d is odd Number\n",number);

  return 0;
}

Output:

Enter a number: 5
5 is odd 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 :
Odd Number Program in C
C program to print even numbers using for loop