Search



Saturday, 7 February 2015

Even-Odd

In this program, the condition of even or odd is being checked and so the number has to be divisible by 2. The following program basically, checks this condition after taking input by user. The output will be printed as the number is even or odd.


Programs to check Even-Odd.

#include<stdio.h>
#include<conio.h>
void main()
{       int a;
clrscr();
printf("program to check whether no. entered is even or odd");
printf("\n\n enter value of a : ");
scanf("%d",&a);
if((a%2)==0)
{ printf("\n\n\t no. is even ");
}
else
{ printf("\n\n\t no. is odd ");
}
getch();
}



No comments:

Post a Comment

Guys if you think something is wrong or should be edit than please do comment.