program 8: Accept a number check whether number is even.
#include<stdio.h>
int main()
{
int num;
printf("\nEnter Number:");
scanf("%d", &num);
if(num%2==0)
{
printf("\n%d is Even",num);
}
else
{
printf("\n%d is Odd",num);
}
}
Output
[root@localhost Desktop]# cd ~/Desktop
[root@localhost Desktop]# gcc even.c
[root@localhost Desktop]# ./a.out
Enter Number:8
8 is Even
0 coment�rios: