Question
Find the largest of two numbers entered by the user.
Solution
β Verified
#include <stdio.h>
int main() {
int a, b;
printf("Enter two numbers: ");
scanf("%d %d", &a, &b);
if (a > b)
printf("%d is greater.\n", a);
else
printf("%d is greater.\n", b);
return 0;
}
Click here to download practice questions on
If Else StatementMore Questions on If Else Statement
Question 2
Check if a person can vote and also check if they are a senior citizen using nested if.
View solution
Question 8
Write a program in C to Check whether a character is uppercase or lowercase.
View solution
Question 13
Write a program in C to Check if a person is eligible to vote by checking his or her age.
View solution