How to Check Even or Odd Number in C language
#include<stdio.h>
void main()
{
int num; //declaration of variables
printf("Enter Any Number");
scanf("%i", &num); // getting the first value from user
// if-else condition to check even or odd
if(num% 2 == 0)
{
printf("You have entered even number");
}
if(num% 2 == 1)
{
printf("You have entered odd number");
}
}
void main()
{
int num; //declaration of variables
printf("Enter Any Number");
scanf("%i", &num); // getting the first value from user
// if-else condition to check even or odd
if(num% 2 == 0)
{
printf("You have entered even number");
}
if(num% 2 == 1)
{
printf("You have entered odd number");
}
}
Comments
Post a Comment