Make a C program that asks the users to enter two numbers. Then, get the total and DISPLAY "I LOVE MY PARENTS" if the sum is more than or equal to 25, otherwise DISPLAY "I WILL NEVER GIVE UP!". And, show which number is greater and lower.
#include <stdio.h>
int main()
{
int a, b, sum;
printf("Enter number1: ");
scanf("%d", &a);
printf("Enter number2: ");
scanf("%d", &b);
sum = a+b;
if (sum >= 25) {
printf("I LOVE MY PARENTS\n");
}
else {
printf("I WILL NEVER GIVE UP!\n");
}
if (a > b) {
printf("%d is greater, %d is lower\n", a, b);
}
else if (a < b) {
printf("%d is greater, %d is lower\n", b, a);
}
else {
printf("Entered numbers are equal\n");
}
return 0;
}
Comments
Leave a comment