if else statement even odd c program

By | June 17, 2019

This is an if else statement even odd c program. It inputs a number from user and checks it for even or odd number. It displays a suitable message accordingly.

/*input a number. Check whether this
number is even or odd
*/
#include<stdio.h>
int main()
{
    int num;
    printf("Enter a number to check for even / odd:");
    scanf("%d",&num);
    if(num%2 == 0)
        printf("%d is even",num);
    else
        printf("%d is odd",num);
    return 0;
}
if else statement even odd c program
if else statement even odd c program

You may also like a related C program To check number for even odd using conditional ternary operator

You may also like a related program to find even odd in C++ on easycppprogramming.blogspot.com

Leave a Reply

Your email address will not be published. Required fields are marked *