#include <stdio.h>
#include <conio.h>
int main()
{
float a,b,sum,sub,mul,div;
char ch;
printf("Enter a number: \n");
scanf("%f", &a);
printf("Enter another number: \n");
scanf("%f", &b);
sum=a+b;
sub=a-b;
mul=a*b;
div=a/b;
printf("What do you want?\n");
printf("a: summation.\t b: subtraction.\nc: multiplication.\t d: division.\n");
scanf(" %c",&ch);
if(ch == 'a')
{
printf("summation value: %.2f\n",sum);
}
else if(ch == 'b')
{
printf("subtraction value: %.2f\n",sub);
}
else if(ch == 'c')
{
printf("multiplication value: %.2f\n",mul);
}
else if(ch == 'd')
{
printf("division value: %.2f\n",div);
}
else
{
printf("something went wrong!!\n");
}
return 0;
}
Now Try it by yourself.If you face any problem and you have any question regarding the program you can comment below.
Thank you.
No comments:
Post a Comment