Breaking

Search

Saturday, June 6, 2020

Switch statement



#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,ch;
clrscr();
Printf("t1add\t2.sub\t3.mul\t4.div");
Printf("\n Enter your choice:");
Scanf("%d",&ch);
Printf("\n Enter the two number");
Scanf("%d%d",&a,&b,);
Switch(ch)
{
case1:
c=a+b;
printf("\n The addition of two number is:%d,"();
Break;
case2:
c=a-b;
printf("\n The Substraction of two number is:%d,"();
Break;
case3:
c=a*b;
printf("\n The multiplication of two number is:%d,"();
Break;
case4:
c=a/b;
printf("\n The divition of two number is:%d,"();
Break;
}
getch();
}








OUTPUT:
1)Add
2)Sub
3)Mul
4)div

Enter your choice:1
Enter two numbers:3,5
The Addition of two number is:8





No comments:

Post a Comment