C Program to check whether a given number is even or odd

 C Program to check whether a given number is even or odd


#include<stdio.h>
int main() 
{
    int a;
    printf("Enter a number : ");
    scanf("%d",&a);
    if(a%2==0)
    {
        printf("The given number is even ");
    }
    else
    {
        printf("The given number is odd");
    }
    return 0;
}

Output 1:

Output 2:

Explanation :

            Hi, in this program we accept a integer and check the 

condition if it is divisible by 2 , if yes print even else print odd. 

Previous Post Next Post