C program to find the maximum of two numbers using switch statement

In this post we will use switch case to find the maximum of two numbers using c language.

Code for C program to find the maximum of two numbers using switch statement

#include<stdio.h>
#include<conio.h>
int main()
{
int num1, num2;
printf("Enter two numbers:");
scanf("%d %d",&num1, &num2);
switch(num1>num2)
{
case 0:
printf("%d is maximum", num2);
break;
case 1:
printf("%d is maximum", num1);
break;
}
return 0;
}

Output

Enter two numbers:45 68
68 is maximum

Read: C program to create a calculator using a switch statement


If You Like This Page Then Make Sure To Follow Us on Facebook, G News and Subscribe Our YouTube Channel. We will provide you updates daily.
Shares
facebook sharing button Share
twitter sharing button Tweet
whatsapp sharing button Share
telegram sharing button Share
pinterest sharing button Pin

Leave a Comment