C Programming Code Examples C > If Else and Switch Case Code Examples C program to find maximum between three numbers C program to find maximum between three numbers Write a C program to find maximum between three numbers using ladder if else or nested if. How to find maximum or minimum between three numbers using if else in C programming. In this program we will continue our discussion and we will write program to find maximum between three numbers. Step by step descriptive logic to find maximum between three numbers. Input three numbers from user. Store it in some variable say j1, j2 and j3. Compare first two numbers i.e. j1 > j2. If the statement is true then j2 is surely not max value. Perform one more comparison between j1 with j3 i.e. if(j1 > j3), then j1 is max otherwise j3. If the statement j1 > j2 is false. Which indicates that j1 is not max. Hence, this time compare j2 with j3. If the statement j2 > j3 is true then j2 is max otherwise j3. #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) { if(j1 > j3) { /* If j1 > j2 and j1 > j3 */ max = j1; } else { /* If j1 > j2 but j1 > j3 is not true */ max = j3; } } else { if(j2 > j3) { /* If j1 is not > j2 and j2 > j3 */ max = j2; } else { /* If j1 is not > j2 and j2 > j3 */ max = j3; } } /* Print maximum value */ printf("Maximum among all three numbers = %d", max); return 0; }