Check whether a number is even or odd using if else statement in C Language

Introduction: In the previous article i explained How to swap two numbers without using temporary variable in C Language? and Check whether a number is positive or negative using if else and What is For loop in C language? Program to print counting up to given limit and Find month name corresponding to number using switch case and Find greatest of three numbers using multiple if statement and Find greatest of two numbers using conditional operator .
Now in this article i have written a program to check whether the entered number is even number or the odd number using C language. Concept is very simple.

Implementation: Let's check it out by an example program.

#include<conio.h>
#include<stdio.h>
main()
{
      int num;
      printf("Enter any number: ");
      scanf("%d",&num);
      if(num%2==0)
      printf("%d is even number",num);
      else
      printf("%d is odd number",num);
      getch();
      }

  • Now run the program using Ctrl+F9
Output:
First Run:
  Enter any number: 90
  90 is even number
Second Run:
  Enter any number: 75
  75 is odd number

Now over to you:
"If you like my work; you can appreciate by leaving your comments, hitting Facebook like button, following on Google+, Twitter, Linked in and Pinterest, stumbling my posts on stumble upon and subscribing for receiving free updates directly to your inbox . Stay tuned and stay connected for more technical updates."
Previous
Next Post »

If you have any question about any post, Feel free to ask.You can simply drop a comment below post or contact via Contact Us form. Your feedback and suggestions will be highly appreciated. Also try to leave comments from your account not from the anonymous account so that i can respond to you easily..