fork download
  1. #include <stdio.h>
  2. #define _CRT_SECURE_NO_WARNINGS
  3.  
  4. void print (float number) {
  5. printf ("Your number is %.2f\n", number);
  6. }
  7. float del (float a, float b) {
  8. float res;
  9. if (b != 0);
  10. res = a / b;
  11. else
  12. res = 0;
  13. return res;
  14. }
  15. int main () {
  16. int num_1, num_2;
  17. scanf ("%d", &num_1);
  18. scanf ("%d", &num_2);
  19. float result = del (num_1, num_2);
  20. print (result);
  21.  
  22. return 0;
  23. }
  24.  
Compilation error #stdin compilation error #stdout 0s 4516KB
stdin
25, 3;
compilation info
prog.c: In function ‘del’:
prog.c:9:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
  if (b != 0);
  ^~
prog.c:10:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
   res = a / b;
   ^~~
prog.c:11:2: error: ‘else’ without a previous ‘if’
  else
  ^~~~
prog.c: In function ‘main’:
prog.c:17:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
  scanf ("%d", &num_1);
  ^~~~~~~~~~~~~~~~~~~~
prog.c:18:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
  scanf ("%d", &num_2);
  ^~~~~~~~~~~~~~~~~~~~
stdout
Standard output is empty