Question
Find Largest of Three Numbers using nested if
Solution
β Verified
#include <stdio.h>
int main() {
int a, b, c;
printf("Enter three numbers: ");
scanf("%d %d %d", &a, &b, &c);
if (a > b) {
if (a > c) {
printf("Largest: %d\n", a);
} else {
printf("Largest: %d\n", c);
}
} else {
if (b > c) {
printf("Largest: %d\n", b);
} else {
printf("Largest: %d\n", c);
}
}
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 7
Write a program in C to Check whether a character is uppercase or lowercase.
View solution
Question 12
Write a program in C to Check if a person is eligible to vote by checking his or her age.
View solution