C Programming Code Examples C > If Else and Switch Case Code Examples C program to find maximum between two numbers using switch case C program to find maximum between two numbers using switch case Write a C program to input two numbers from user and find maximum between two numbers using switch case. How to find maximum or minimum between two numbers using switch case. In all our previous exercises on switch...case we switched variable value. However, you can also write an expression inside switch. The expression j1 > j2 evaluates 1 if j1 is greater than j2 otherwise evaluates 0. So if we write switch(j1 > j2), there can be two possible cases case 0 and case 1. Step by step descriptive logic to find maximum using switch...case. Input two numbers from user. Store it in some variable say j1 and j2. Switch expression switch(j1 > j2). For the expression (j1 > j2), there can be two possible values 0 and 1. Write case 0 and print j2 is maximum. Write case 1 and print j1 is maximum. Important note: There is no possibility of default case in this program. #include <stdio.h> int main() { int j1, j2; /* Input two numbers from user */ printf("Enter two numbers to find maximum: "); scanf("%d%d", &j1, &j2); /* Expression (j1 > j2) will return either 0 or 1 */ switch(j1 > j2) { /* If condition (j1>j2) is false */ case 0: printf("%d is maximum", j2); break; /* If condition (j1>j2) is true */ case 1: printf("%d is maximum", j1); break; } return 0; }