Check the number is odd or not

6.Write a program to check whether the number is odd or even?
#include
#include
void main ()
{
int a;
clrscr();
printf("enter the no.");
scanf("%d",&a);
if(a%2==0)
printf("no. is even %d",a);
else
printf("odd");
getch();
}

Algorithum
1.start
2.read a
3.if (a%2=0)
4.print even
5.else
6.print odd
7.stop


Result
The program was sucessfully executed and desired output is obtained

Output
enter the no
4
even

0 comments:

Post a Comment