C program to check whether a given number is EVEN or ODD

C program for EVEN or ODD: Here, we are reading an integer number from the user and checking whether it is EVEN or ODD.

Given an integer number and we have to check it is EVEN or ODD using C program.

The numbers which are divisible by 2 are EVEN numbers and which are not divisible by 0 are not as ODD numbers.

To check whether given number is EVEN or ODD, we are checking modulus by dividing number by 2, if the modulus is 0, then it will be completely divisible by 2 hence number will be EVEN or its will be ODD.

Example 1:

    Enter number: 12
    12 is an EVEN number.

Example 2:

    Enter number: 19
    19 is an ODD number.

C program to check EVEN or ODD

/* c program to check whether number is even or odd*/
#include <stdio.h>
int main()
    int num;
    printf("Enter an integer number: ");
    /*If number is divisible by 2 then number 
    is EVEN otherwise number is ODD*/
        printf("%d is an EVEN number.",num);
        printf("%d is an ODD number.",num);
    return 0;


    First Run:
    Enter an integer number: 123
    123 is an ODD number.

    Second Run:
    Enter an integer number: 110
    110	 an EVEN number.

C Basic Programs »

Related Programs


Comments and Discussions!

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.