pTutorial

New way to learn C programming

C Program to check even or odd

This is a simple c program to check whether an entered number is even or odd using different methods like using modulus operator, conditional operator etc.

Even number: Number is completely divided by 2

C example of check even or odd using modulus operator

#include <stdio.h>
#include <conio.h>
void main()
{
   int n;
 
   printf("Enter an integer\n");
   scanf("%d",&n);
 
   if ( n%2 == 0 )
      printf("Entered number is Even\n");
   else
      printf("Entered number is Odd\n");
 
   getch();

Download C program to check even

Output of program

c program check even or odd

In this example, modulus operator is used to finding the remainder and after that check it's zero if its zero then the number is even otherwise odd.

See Also

How to get the mouse position using jquery   |   Php5 classes.php   |   C program to swapping of two number

QUOTES OF THE DAY

Impossible is a word only be found in the dictionary of fools.

LIKE ON FACEBOOK

+1 ON GOOGLE

SHARE ON TWITTER