C Program To Read A Number And To Check Whether The Given Number Is Even Or Odd.

#include<stdio.h>
#include<conio.h>
main()
{
int number,remainder;
clrscr();
printf("\n Enter a number:");
scanf("%d",&number);
remainder=number%2;
if(remainder== 0)
printf("\n The  given number is even number");
else
printf("\n The  given number is odd number");
getch();

}

Explanation:
Take a number is 95
remainder =95%2, we get 1 as remainder
The number 95 is odd number
Output:
Run-1
Run-2

No comments:

Post a Comment

100 C Programs with Code and Output

Program 1: C Program To Read Two Numbers And Print The Sum Of Given Two Numbers. Program 2: C Program To Read Three Numbers And Prin...