PROGRAM:
#include<stdio.h>
main()
{
int a,b,ch,c;
printf("\nEnter
the Number 1:\n"); scanf("%d",&a);
printf("\nEnter
the Number 2:\n"); scanf("%d",&b);
printf("\n1.Add\n2.Subtract\n3.Multiply\n4.Divide\n");
printf("\nEnter the Choice:\n");
scanf("%d",&ch);
switch(ch)
{
case 1:
c=a+b;
printf("\n
%d + %d = %d\n",a,b,c); break;
case 2: c=a-b;
printf("\n
%d - %d = %d\n",a,b,c); break;
case 3: c=a*b;
printf("\n
%d * %d = %d\n",a,b,c); break;
case 4: c=a/b;
printf("\n
%d / %d = %d\n",a,b,c); break;
}
}
OUTPUT:
Enter
the Number 1: 15
Enter
the Number 2: 56
1.Add
2.Subtract
3.Multiply
4.Divide
Enter the
Choice: 2 15 - 56 = -41
No comments:
Post a Comment