#include<stdio.h>
#include<conio.h>
int main()
{
float a, b,result;
int choice;
clrscr();
printf("enter your choice");
printf("\n1.Sum\n2.subtraction\n3.multiplication\n4.division ");
scanf("%d", &choice);
switch (choice)
{
case 1:
printf("\nenter two no.s");
scanf("%f%f", &a, &b);
result = a + b;
break;
case 2:
printf("\nenter two no.s");
scanf("%f%f", &a, &b);
result = a - b;
break;
case 3:
printf("\nenter two no.s");
scanf("%f%f", &a, &b);
result = a * b;
break;
case 4:
printf("\nenter two no.s");
scanf("%f%f", &a, &b);
result = a / b;
break;
default:
printf("\nenter valid choice");
break;
}
printf("\nthe result is %f", result);
getch();
return 0;
}
0 comments:
Post a Comment