fork download
  1. #include<stdio.h>
  2.  
  3. int A, B, choice, Add, minus, multi;
  4.  
  5. int main() {
  6.  
  7. printf("Welcome to the program:\n 1. Add\n 2. Minus\n 3. Multiply\n");
  8.  
  9. printf("Input choice (1-3): ");
  10. scanf("%d", &choice);
  11.  
  12. if (choice == 1) {
  13. printf("Input A: ");
  14. scanf("%d", &A);
  15.  
  16. printf("Input B: ");
  17. scanf("%d", &B);
  18.  
  19. Add = A + B;
  20. printf("A + B = %d", Add);
  21. }
  22. else if (choice == 2) {
  23. printf("Input A: ");
  24. scanf("%d", &A);
  25.  
  26. printf("Input B: ");
  27. scanf("%d", &B);
  28.  
  29. minus = A - B;
  30. printf("A - B = %d", minus);
  31. }
  32. else if (choice == 3) {
  33. printf("Input A: ");
  34. scanf("%d", &A);
  35.  
  36. printf("Input B: ");
  37. scanf("%d", &B);
  38.  
  39. multi = A * B;
  40. printf("A * B = %d", multi);
  41. }
  42. else {
  43. printf("Error! Please input 1-3 only.");
  44. }
  45.  
  46. printf("\nProgram by Warathip Woraphong M.5/2 No.30");
  47.  
  48. return 0;
  49. }
Success #stdin #stdout 0s 5288KB
stdin
Standard input is empty
stdout
Welcome to the program:
 1. Add
 2. Minus
 3. Multiply
Input choice (1-3): Error! Please input 1-3 only.
Program by Warathip Woraphong M.5/2 No.30