Programming in C- Program to find whether given number is even or odd
/* if - else */
#include
#include
void main()
{
int n;
clrscr();
printf("Enter the Number : ");
scanf("%d",&n);
if((n%2)==0)
{
printf("%d is an Even number",n);
}
else
{
printf("%d is an Odd number",n);
}
getch();
}
Output :
Enter the Number : 12
12 is an Even number
#include
#include
void main()
{
int n;
clrscr();
printf("Enter the Number : ");
scanf("%d",&n);
if((n%2)==0)
{
printf("%d is an Even number",n);
}
else
{
printf("%d is an Odd number",n);
}
getch();
}
Output :
Enter the Number : 12
12 is an Even number
Comments
Post a Comment