Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(void){
- double d1;
- double d2;
- char operation;
- int result;
- printf("Digit 1: ");
- scanf("%lf", d1);
- printf("Operation: |+|-|*|/|");
- scanf("%c", operation);
- printf("Digit 2: ");
- scanf("%lf", d2);
- switch(operation){
- case '+':
- result = d1 + d2;
- break;
- case '-':
- result = d1 - d2;
- break;
- case '*':
- result = d1 * d2;
- break;
- case '/':
- result = d1 / d2;
- break;
- default:
- printf("Error");
- }
- printf("Result: " + result);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement