We all must have read about Even and odd in our childhood because it is an important topic in math.
We all know that the number that is completely cut off from two is an even number, and the number that is not cut off is an odd number.
But do you know how to write the code so that we can find out Even and Odd numbers through the computer? If not, then stay with us in this post.
In this post, I have told you all about a program to find out Even and Odd numbers in C Programming, through which you will be able to find out Even and odd numbers with the help of a computer.
C Program To Find Whether a Number is Even or Odd
/*Program of finding whether a number is even or odd in c programming*/
#include <stdio.h>
int main()
{
int number;
printf("Enter any Number: ");
scanf("%d", &number);
if (number % 2 == 0)
{
printf("%d is a even number.\n", number);
}
else
{
printf("%d is a odd number.\n", number);
}
return 0;
}
Summary
If you want to learn similar programming questions and concepts in an easy language, then you can explore our site, where you will find a lot of content.
Similar articles
- C Programming Basics for Beginners in 2023
- Instructions and operators in c programming
- Difference between a programming language and a natural language?
- 20+ Basic Practice Programs of C Programming
- How to Become a freelance coder and work remotely in 2023
- C Program to calculate the area of a triangle