Write C program to check whether a number is even or odd

 #include<stdio.h>


int main()
{
    int a;
    printf("Enter the number which you want to check if it it is even or odd\n");
    scanf("%d", &a);
    if (a % 2 == 0)
    {
        printf("The entered %d integer is a Even number"a);
    }
    else{
        printf("The entered %d integer is an Odd number"a);
    }
    return 0;
    
}

Now if you enter 7 then the output will be Odd
and if you enter 8 then the output will be Even
Hope this will help you. Happy programming

Comments

Popular posts from this blog

Simple Rock Paper Scissors Game(Java)

Access denied in VS code for gcc while doing C programming