fork(1) download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int i;
  5. int a,b,c;
  6. printf("Enter the value of a and b is %d %d",&a, &b);
  7. scanf("%d%d",&a&b);
  8. printf("enter your choice");
  9. scanf("%d", & i);
  10. switch(i)
  11. {
  12. case1: Addition
  13. c=a+b;
  14. printf("addition is %d \n",c);
  15. break;
  16. case2: subtracion
  17. c=a-b;
  18. printf("subtracion is %d\n",c);
  19. break;
  20. case3:multiplication
  21. c=a*b;
  22. printf("multiplication is %d\n",c);
  23. break;
  24. case4: division
  25. c=a/b;
  26. printf("division is%d\n",c);
  27. break;
  28. case5: default
  29. printf("invalide input");
  30. }
  31.  
  32.  
  33.  
  34. return 0;
  35. }
  36.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function 'main':
prog.c:6:9: warning: format '%d' expects argument of type 'int', but argument 2 has type 'int *' [-Wformat=]
  printf("Enter the value of a and b is %d %d",&a, &b);
         ^
prog.c:6:9: warning: format '%d' expects argument of type 'int', but argument 3 has type 'int *' [-Wformat=]
prog.c:7:17: error: invalid operands to binary & (have 'int *' and 'int')
  scanf("%d%d",&a&b);
                 ^
prog.c:12:10: error: a label can only be part of a statement and a declaration is not a statement
   case1: Addition
          ^
prog.c:12:10: error: unknown type name 'Addition'
prog.c:16:10: error: a label can only be part of a statement and a declaration is not a statement
   case2: subtracion
          ^
prog.c:16:10: error: unknown type name 'subtracion'
prog.c:17:4: error: redefinition of 'c'
    c=a-b;
    ^
prog.c:13:4: note: previous definition of 'c' was here
    c=a+b;
    ^
prog.c:20:9: error: a label can only be part of a statement and a declaration is not a statement
   case3:multiplication
         ^
prog.c:20:9: error: unknown type name 'multiplication'
prog.c:21:4: error: redefinition of 'c'
    c=a*b;
    ^
prog.c:17:4: note: previous definition of 'c' was here
    c=a-b;
    ^
prog.c:24:10: error: a label can only be part of a statement and a declaration is not a statement
   case4: division
          ^
prog.c:24:10: error: unknown type name 'division'
prog.c:25:4: error: redefinition of 'c'
    c=a/b;
    ^
prog.c:21:4: note: previous definition of 'c' was here
    c=a*b;
    ^
prog.c:29:6: error: expected ':' before 'printf'
      printf("invalide input");
      ^
prog.c:28:5: warning: label 'case5' defined but not used [-Wunused-label]
     case5: default
     ^
prog.c:24:3: warning: label 'case4' defined but not used [-Wunused-label]
   case4: division
   ^
prog.c:20:3: warning: label 'case3' defined but not used [-Wunused-label]
   case3:multiplication
   ^
prog.c:16:3: warning: label 'case2' defined but not used [-Wunused-label]
   case2: subtracion
   ^
prog.c:12:3: warning: label 'case1' defined but not used [-Wunused-label]
   case1: Addition
   ^
prog.c:5:10: warning: unused variable 'c' [-Wunused-variable]
  int a,b,c;
          ^
stdout
Standard output is empty