Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- int main()
- {
- printf("Enter first number: ");
- int a;
- scanf("%d",&a);
- printf("Enter second number: ");
- int b;
- scanf("%d",&b);
- printf ("Choose the action: '+' or '-' or '*' or '/' : ");
- char g;
- scanf(" %c",&g);
- double z;
- if (g == '+') z = a + b;
- else if (g == '-') z = a - b;
- else if (g == '*') z = a * b;
- else if (g == '/') z = (double)a / b;
- else {
- printf("You choose incorect action.");
- return 0;
- }
- printf("Anser is: %f", z);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement