3/07/2016

C Program For Check Number Is Even Or Odd

Problem :- Write A C Program For Check Number Is Even Or Odd

Logic :- Logic is very very simple as we know that if number is divisible by 2 then number is Even else Number is Odd 
Example :- number form 1 to 10 .
1-Odd
2-Even
3-Odd
4-Even
5-Odd
6-Even
7-Odd
8-Even
9-Odd
10-Even

Try Yourself C++ Program To Check Year Is Leap Year Or Not

Solution :- 

#include<stdio.h>

int main()
{
int num;

printf("\nEnter Any Number To Check Even Or Odd :\n");
scanf("%d", &num);

if (num%2 == 0)
{
   printf("%d is EVEN\n", num);
}
else
{
   printf("%d is ODD\n", num);
}
return 0;
}

Output:-

C Program For Check Number Is Even Or Odd

Previous Post
Next Post

post written by:

Hi, I’m Ghanendra Yadav, SEO Expert, Professional Blogger, Programmer, and UI Developer. Get a Solution of More Than 500+ Programming Problems, and Practice All Programs in C, C++, and Java Languages. Get a Competitive Website Solution also Ie. Hackerrank Solutions and Geeksforgeeks Solutions. If You Are Interested to Learn a C Programming Language and You Don't Have Experience in Any Programming, You Should Start with a C Programming Language, Read: List of Format Specifiers in C.
Follow Me

0 Comments: