WAP to input two integers and if both are even find their sum else find their product using conditional operator
QGP:
Which Programming Language do you want it in?
Answers
Answered by
1
Answer:
#include <stdio.h>
int main()
{
int sum=0, pro=1, num1, num2;
printf("Enter any two number to find its factor: ");
scanf("%d%d", &num1, &num2);
if (num1%2==0 && num2%2==0)
{
sum=num1+num2;
printf("sum of both even numbers are: ", sum);
}
else
{
pro=num1*num2;
printf("Product of both odd numbers are: ", pro);
}
return 0;
}
Similar questions