Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int choice;
- float x, y, result;
- printf("1. Addition\n");
- printf("2. Subtraction\n");
- printf("3. Multiplication\n");
- printf("4. Division\n");
- printf("5. Exit\n\n");
- printf("Enter your choice: ");
- scanf("%d", &choice);
- if (choice >= 1 && choice <= 4)
- {
- printf("Enter any two numbers: ");
- scanf("%lf %lf", &x &y);
- }
- switch(choice)
- {
- case 1:
- result = x+y;
- printf("Result = %0.2f", result);
- break;
- case 2:
- result = x-y;
- printf("Result = %0.2f", result);
- break;
- case 3:
- result = x*y;
- printf("Result = %0.2f", result);
- break;
- case 4:
- result = x%y;
- printf("Result = %0.2f", result);
- break;
- case 5:
- return 0;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement