Matrix Switch control in C programming

#include<stdio.h>
#include<conio.h>
void main()
{
int ch,a,b,add,sub,mul;
clrscr();
printf("1.addition\n 2.substraction\n 3.multiplication\n 4.substraction\n");
printf("enter choice");
scanf("%d",&ch);
printf("a,b");
scanf("%d %d",&a,&b);
switch(ch)
{
case 1:
add=a+b;
printf("addition=%d",add);
break;
case 2:
sub=a-b;
printf("substraction=%d",sub);
break;
case 3:
mul=a*b;
printf("multiplication=%d",mul);
break;
case 4:
sub=a/b;
printf("substraction=%d",sub);
break;
}
getch();
   }



Post a Comment

0 Comments