Q. Which of the following syntax is correct for nested if-else statements?
β
Correct Answer: (A)
if(exp1){ if(exp2){ } } else { if(exp3){ } }
Explanation: The correct syntax for nested if-else statements in C programming is:
if(exp1){
if(exp2){
}
}
else {
if(exp3){
}
}
if(exp1){
if(exp2){
}
}
else {
if(exp3){
}
}