C Program to Check Two Numbers If Even or Odd
#include<stdio.h>
void main()
{
int num1, num2; //declaration of variables
printf("Enter First Number");
scanf("%i", &num1); // getting the first value from user
printf("Enter Second Number");
scanf("%i", &num2); // getting the second value from user
if(num1% 2 == 0 && num2% 2 == 0)
{
printf("You have entered two even numbers");
}
if(num1% 2 == 1 && num2% 2 == 1)
{
printf("You have entered two odd numbers");
}
else
{
printf("You have entered one even number and one odd number");
}
}
void main()
{
int num1, num2; //declaration of variables
printf("Enter First Number");
scanf("%i", &num1); // getting the first value from user
printf("Enter Second Number");
scanf("%i", &num2); // getting the second value from user
if(num1% 2 == 0 && num2% 2 == 0)
{
printf("You have entered two even numbers");
}
if(num1% 2 == 1 && num2% 2 == 1)
{
printf("You have entered two odd numbers");
}
else
{
printf("You have entered one even number and one odd number");
}
}
Comments
Post a Comment