fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. // your code goes here
  5. return 0;
  6. }
  7. #include<stdio.h>
  8. void main()
  9. {
  10.  
  11. int a,b;
  12. char ch;
  13. printf("press\n 1.addition \n 2.substraction\n 3.multiplication \n 4.division\n");
  14. printf("\nenter choice:");
  15. scanf("%c",&ch);
  16. printf("\nenter integer:");
  17. scanf("%d",&a);
  18. printf("\nenter integer:");
  19. scanf("%d",&b);
  20.  
  21. switch(ch)
  22. {
  23. case '+':
  24. printf("%d+%d=%d",a,b,a+b);
  25. break;
  26. case '-':
  27. printf("%d-%d=%d",a,b,a-b);
  28. break;
  29. case '*':
  30. printf("%d*%d=%d",a,b,a*b);
  31. break;
  32. case '/':
  33. printf("%d/%d=%d",a,b,a/b);
  34. break;
  35. default:
  36. printf("error");
  37. break;
  38. }
  39. }
  40.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:8:6: warning: return type of ‘main’ is not ‘int’ [-Wmain]
 void main()
      ^~~~
prog.c:8:6: error: conflicting types for ‘main’
prog.c:3:5: note: previous definition of ‘main’ was here
 int main(void) {
     ^~~~
prog.c: In function ‘main’:
prog.c:15:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%c",&ch);
     ^~~~~~~~~~~~~~~
prog.c:17:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&a);
     ^~~~~~~~~~~~~~
prog.c:19:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&b);
     ^~~~~~~~~~~~~~
stdout
Standard output is empty