Example program for nested if statement in C: 1


#include <stdio.h>
int main()
{
int a=40,b=20;
if (a>b) {
printf(“a is greater than b”);
}
else if(a<b) {
printf(“a is less than b”);
}
else {
printf(“a is equal to b”);
}
}

output:

a is greater than b


Leave a comment

Your email address will not be published. Required fields are marked *

One thought on “Example program for nested if statement in C: