if-else statement is used when a unit of code to be executed by a condition true or false. See the example C program below.
printf(“Enter the marks\n”);
if (marks >= 30)
printf(” Student is pass\n”);
printf(” Student is fail\n”);
Case 1: Suppose you enter 20 means if condition is false, then this compiler execute else part only, the output will be:-
Case 2 : Suppose you enter 50 means if condition is true, then compiler execute if part only, the output will be:-