C Program To Check Even or Odd Number

The following is a C Program to Check Even or Odd Number on screen after taking input from user. Let's get started.

C Program To Check Even/Odd Number
C Program To Check Even/Odd Number

Overview:


Commands

scanf() function is used to obtain input and printf() function is used to print the string on the screen.
if() statement is used as test function.

Program

#include<stdio.h>
#include<conio.h>
void main()
{
    int x;
    clrscr();
    printf("Enter any number: \n");
    scanf("%d",&x);
    /*working formula*/
    if(x%2==0)
    {
        printf("The entered number is EVEN");
    }
    else
    {
        printf("The entered number is ODD");
    }
    getch();
}


Output

Odd Even Output
Odd Even Output

All programs compiled in this post are compiled in AnDOSBox.

Books I Prefer:






I hope this article was helpful to understand C Program to Check Even or Odd Number! Comment below, if you've got any question. Head back soon for another interesting article on C Programming.