Skip to content
Home » C Program to Find Even or Odd using if-else

C Program to Find Even or Odd using if-else

Learn about C Program to Find Even or Odd 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.

C Program to Find Even or Odd using if-else

An even number is a two-digit integer that is divisible by 2. An odd number is one that is not divisible by 2.

Program:

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

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

   if(number%2==0)
   {
     printf("%d is an even number",number);
   }
   else
   {
     printf("%d is an odd number",number);
   }

   return 0;
 }

Output:

Enter a number: 8
8 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 :
C Program to Find Positive or Negative
C Program to Check Number is Multiple of 7 or not