Friday, May 20, 2016

C program for finding a number is even or odd

Program
#include<stdio.h>
main()
{
int a;
printf("enter a number: \n");
scanf("%d",&a);
if(a%2==0)
{
printf("a is even \n");
}
else
{
printf("a is odd \n");
}

Output
enter a number:
5
a is odd

No comments:

Post a Comment