Write a C Program to check whether number is EVEN or ODD

By | 02.11.2016

Check whether number is EVEN or ODD


Write a C Program to check whether number is EVEN or ODD. Here’s simple Program to check whether number is EVEN or ODD in C Programming Language.


An even number is an integer that is exactly divisible by 2. Example: 0, 8, -24

An odd number is an integer that is not exactly divisible by 2. Example: 1, 7, -11, 15

To check whether an integer is even or odd, the remainder is calculated when it is divided by 2 using modulus operator %. If remainder is zero, that integer is even if not that integer is odd.


Below is the source code for C Program to check whether number is EVEN or ODD which is successfully compiled and run on Windows System to produce desired output as shown below :


SOURCE CODE : :


/*  C Program to check whether number is EVEN or ODD  */

#include <stdio.h>
int main()
{

    int num;

    printf("Enter an integer number :: ");
    scanf("%d",&num);

    /*If number is divisible by 2 then number
    is EVEN otherwise number is ODD*/

    if(num%2==0)
        printf("\n%d is an EVEN number.",num);
    else
        printf("\n%d is an ODD number.",num);

    return 0;
}

OUTPUT : :


First Run:

    Enter an integer number: 27
    
    27 is an ODD number.

Second Run:

    Enter an integer number: 88
    
    88 is an EVEN number.

Above is the source code for C Program to check whether number is EVEN or ODD which is successfully compiled and run on Windows System.The Output of the program is shown above .

If you found any error or any queries related to the above program or any questions or reviews , you wanna to ask from us ,you may Contact Us through our contact Page or you can also comment below in the comment section.We will try our best to reach up to you in short interval.


Thanks for reading the post….

3.7 10 votes
Article Rating
Category: Basic Programs C Programming Number Programs Tags:

About Tunde A

My name is Tunde Ajetomobi, a Tech Enthusiast and Growth Hacker. I enjoy creating helpful content that solves problem across different topics. Codezclub is my way of helping young aspiring programmers and students to hone their skills and find solutions on fundamental programming languages.

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments