To find whether the given number is even or odd
Program:
#include<stdio.h>
#include<conio.h>
void main()
{
int num;
clrscr();
printf("Enter a number : ");
scanf("%d", &num);
if(num % 2 == 0)
printf("\nThe given number is even");
else
printf("\nThe given number is odd");
getch();
}
Output:
Case: 1
Enter a number : 10
The given number is even
Case: 2
Enter a number : 5
The given number is odd
-
UpdatedDec 30, 2019
-
Views5,831
You May Like
Program to maintain employee details using structures
Program to maintain student details using structures
Check whether the person is eligible to vote or not
Print the numbers that are divisible by a given no.
Program to generate magic square
To sort the given numbers in ascending & descending order