c-record - 4) switch statement with operators
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("\nenter the value A : ");
scanf("%d",&a);
printf("\nenter the value B : ");
scanf("%d",&b);
printf("\nMenu\n1.Add\n2.Sub\n3.mul\n4.div\n");
printf("Enter your choose Operator : ");
scanf("%d",&c);
switch(c)
{
case 1 :printf("\nAddition = %d",(a+b));
break;
case 2 :printf("\nSubtraction = %d",(a-b));
break;
case 3 :printf("\nmultification= %d",(a*b));
break;
case 4 :printf("\nDivision = %d",(a/b));
break;
default:printf("wrong option");
}
getch();
}
note:- write Five outputs
1) output:-
alt +f9 ------ run and
ctrl+f9 ------ compile
2) output:-
alt +f9 ------ run and
ctrl+f9 ------ compile
3) output:-
alt +f9 ------ run and
ctrl+f9 ------ compile
4) output:-
alt +f9 ------ run and
ctrl+f9 ------ compile
5) output:-
alt +f9 ------ run and
ctrl+f9 ------ compile





Comments
Post a Comment