Write a program to check the entered number is even or odd.

Write a program to check the entered number is even or odd.

 

#include <stdio.h>

#include<conio.h>

void main()

{

clrscr();

int a;

printf (“Enter a number:”)

scanf (“%d”,&a);

if (a%2==0)

{

  printf(“%d is even number”,a);

}

else

{

printf(“%d is odd number”,a);

}

getch();

}

 

 

 

Output:

 

Enter a number:8

8 is even number

 

 

 


Comments