Q:

C Program For Check Number Is Even Or Odd

belongs to collection: If/Else C Programs to Practice

0

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

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#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:

Enter Any Number To Check Even Or Odd:

111

111 is ODD

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Leap Year Program in C [Logic, Examples & Output] ... >>
<< C Program For Check You Are Eligible For Voting Or...