#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
int ch;
clrscr();
printf(“\n1.Add\n2.Subtract\n3.Multiply\n4.Division\n5.Remainder\n);
printf(“\n Enter your choice\n”);
scanf(“%d”,&ch);
switch(ch)
{
case1:
printf(“\nEnter values of a and b\n”);
scanf(“%d%d”,&a,&b);
c=a+b;
printf(“\nThe answer is %d”,c);
break;
case2:
printf(“\nEnter values of a and b\n”);
scanf(“%d%d”,&a,&b);
c=a-b;
printf(“\nThe answer is %d”,c);
break;
case3:
printf(“\nEnter values of a and b\n”);
scanf(“%d%d”,&a,&b);
c=a*b;
printf(“\nThe answer is %d”,c);
break;
case4:
printf(“\nEnter values of a and b\n”);
scanf(“%d%d”,&a,&b);
c=a/b;
printf(“\nThe answer is %d”,c);
break;
case5:
printf(“\nEnter values of a and b\n”);
scanf(“%d%d”,&a,&b);
c=a%b;
printf(“\nThe answer is %d”,c);
break;
default:
printf(“\nEnter the correct choice”);
break;
}
getch();
}
#include<conio.h>
void main()
{
int a,b,c;
int ch;
clrscr();
printf(“\n1.Add\n2.Subtract\n3.Multiply\n4.Division\n5.Remainder\n);
printf(“\n Enter your choice\n”);
scanf(“%d”,&ch);
switch(ch)
{
case1:
printf(“\nEnter values of a and b\n”);
scanf(“%d%d”,&a,&b);
c=a+b;
printf(“\nThe answer is %d”,c);
break;
case2:
printf(“\nEnter values of a and b\n”);
scanf(“%d%d”,&a,&b);
c=a-b;
printf(“\nThe answer is %d”,c);
break;
case3:
printf(“\nEnter values of a and b\n”);
scanf(“%d%d”,&a,&b);
c=a*b;
printf(“\nThe answer is %d”,c);
break;
case4:
printf(“\nEnter values of a and b\n”);
scanf(“%d%d”,&a,&b);
c=a/b;
printf(“\nThe answer is %d”,c);
break;
case5:
printf(“\nEnter values of a and b\n”);
scanf(“%d%d”,&a,&b);
c=a%b;
printf(“\nThe answer is %d”,c);
break;
default:
printf(“\nEnter the correct choice”);
break;
}
getch();
}
No comments:
Post a Comment