Q:

C Program For Check Number Is Even Or Odd

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)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now