accept 2 numbers and display whether both are equal or 1st number is bigger than 2nd or 2nd is bigger than 1st in 'C' program.
Answers
Answered by
13
The given problem is solved using language - C.
#include <stdio.h>
int main() {
int a,b;
printf("Enter a number: ");
scanf("%d",&a);
printf("Enter another number: ");
scanf("%d",&b);
if(a==b)
printf("Both the numbers are equal.");
else if(a>b)
printf("First number is greater than the second.");
else
printf("Second number is greater than the first.");
return 0;
}
- Accept two numbers from the user, say a and b.
- Check if a = b. If true, both are equal.
- If false, check if a > b. If true, first number is greater than second or else, second number is greater than first.
- Display the required output.
See attachments for output.
Attachments:
Similar questions