fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int a ,b;
  5. printf("Enter a:");
  6. scanf("%d" , &a);
  7. printf("Enter b:");
  8. scanf("%d" , &b);
  9. int p;
  10. printf("Enter 1 fpr add 2 for subtract 3 for product 4 for quotient");
  11. scanf("%d" ,&p);
  12. switch(p){
  13. case 1:
  14. printf("sum:%d ",a+b);
  15. break;
  16. case 2:
  17. printf("difference:%d ",a-b);
  18. break;
  19. case 3:
  20. printf("product:%d ",a*b);
  21. break;
  22. case 4:
  23. printf("quotient:%d ",a/b);
  24. break;
  25.  
  26. }
  27. return 0;
  28. }
  29.  
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
Enter a:Enter b:Enter 1 fpr add 2 for subtract 3 for product 4 for quotient