C Programming Code Examples C > If Else and Switch Case Code Examples Program to find maximum using ladder if...else...if Program to find maximum using ladder if...else...if Instead of using nested if else. You can combine two or more conditions together using logical operators. A number j1 among three numbers j1, j2 and j3 is said maximum if j1 > j2 and j1 > j3. Here we will use logical AND && operator to combine two conditions together. Maximum between three numbers is determined by three cases. j1 is maximum if j1 > j2 and j1 > j3. j2 is maximum if j2 > j1 and j2 > j3. j3 is maximum if j3 > j1 and j3 > j2. Let us implement this using logical operator and ladder if else. #include <stdio.h> int main() { int j1, j2, j3, max; /* Input three numbers from user */ printf("Enter three numbers: "); scanf("%d%d%d", &j1, &j2, &j3); if((j1 > j2) && (j1 > j3)) { /* If j1 is greater than both */ max = j1; } else if((j2 > j1) && (j2 > j3)) { /* If j2 is greater than both */ max = j2; } else if((j3 > j1) && (j3 > j2)) { /* If j3 is greater than both */ max = j3; } /* Print maximum number */ printf("Maximum among all three numbers = %d", max); return 0; }