//use of case statement
#include<stdio.h>
void main()
{
int choice, a,b,result;
printf(“Enter the choice\n1.Add\n2.Substract\n3.Multiply\n4.Division\n “);
scanf(“%d”,&choice);
printf(“enter the two numbers”);
scanf(“%d%d”,&a,&b);
switch(choice)
{
case 1: result=a+b;
printf(“\nthe sum of two number is %d”, result);
break;
case 2: result=a-b;
printf(“\nthe difference is %d”, result);
break;
case 3: result= a*b;
printf(“\nthe multiplicaion is %d”,result);
break;
case 4: if(b==0)
{
printf(“\nthe denomininator is zero so division is not possible”);
}
else
{
float result=a/b;
printf(“\nthe devision is %f”,result);
}
break;
default: printf(“\n wrong choice”);
}
printf(“\nThank You”);
}
OUTPUT

In this statement only one operation will be selected to execute according to our choice. Here, 5 output result for my different choice at different time. so keep in your mind that this statement are used only when you have multiple options but have to choose only one just like MCQ. In online examination of MCQ pattern same concept is used though may have other programming language.
