C Program to Check Whether a Number is Even or Odd

Rate this post
#include <stdio.h>
int main()
{
    int n;

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

    // Number will be even if the number is perfectly divisible by 2
    if(number % 2 == 0)
        printf("%d is even number.",n);
    else
        printf("%d is odd Number.",n);

    return 0;
}

Discover more from Shout Me Crunch

Subscribe to get the latest posts sent to your email.

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Discover more from Shout Me Crunch

Subscribe now to keep reading and get access to the full archive.

Continue reading