C Program to Check for Even or Odd Number

This video tutorial teaches you how to write a c program to check whether a number number entered by the user is is even number or odd number.
In this tutorial we are gonna ask the user to enter the number to find even or odd. Then depending on users input we will check whether the number is even or odd and then we print the appropriate message.




Source code for this video tutorial

#include <stdio.h>
#include <stdlib.h>

int main()
{
int number;
printf("Enter the number to check even or odd\n");
scanf("%d",&number);

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

}

Back To Top