fork download
  1. // Online C compiler to run C program online
  2. #include <stdio.h>
  3.  
  4. int main() {
  5. int a,b;
  6. char c;
  7.  
  8. printf("Give a number a =");
  9. scanf("%d",&a);
  10. printf("Give a number b =");
  11. scanf("%d",&b);
  12. printf("Give any operation + - * / %");
  13. scanf("%c",&c);
  14. switch(c)
  15. {
  16. case '+' :
  17. printf("The sum of two numbers%d",a+b);
  18. break;
  19. case '-' :
  20. printf("The subtraction of two numbers%d",b-a);
  21. break;
  22. case '*':
  23. printf("The multiplication of two numbers%d",a*b);
  24. break;
  25. case '/' :
  26. printf("The ddivision of two numbers%d", a/b);
  27. case '%' :
  28. printf("The modulus of two numbers %d",a%b);
  29. break;
  30.  
  31.  
  32.  
  33. }
  34.  
  35. return 0;
  36. }
Success #stdin #stdout 0.03s 25680KB
stdin
Standard input is empty
stdout
// Online C compiler to run C program online
#include <stdio.h>

int main() {
    int a,b;
    char c;
    
    printf("Give a number a =");
    scanf("%d",&a);
    printf("Give a number b =");
    scanf("%d",&b);
    printf("Give any operation + - * / %");
    scanf("%c",&c);
    switch(c)
    {
        case '+'  :
        printf("The sum of two numbers%d",a+b);
        break;
        case '-' :
        printf("The subtraction of two numbers%d",b-a);
        break;
        case '*':
        printf("The multiplication of two numbers%d",a*b);
        break;
        case '/' :
        printf("The ddivision of two numbers%d", a/b);
        case '%' :
        printf("The modulus of two numbers %d",a%b);
        break;
        
        
        
    }
    
    return 0;
}