fork download
  1. #include <stdio.h>
  2.  
  3. int loop_down_to_zero(int i);
  4. int loop_up_to_int(int i);
  5.  
  6. int main(int argc, char* argv[])
  7. {
  8. int i;
  9. printf("Please enter in a positive int: %d");
  10. scanf("%d", &i);
  11.  
  12. loop_down_to_zero(i);
  13. loop_up_to_int(i);
  14.  
  15. return 0;
  16. }
  17.  
  18. void loop_down_to_zero(int i)
  19. {
  20. while(i >= 0)
  21. {
  22. printf("%d\n", i);
  23. i--;
  24. }
  25. }
  26.  
  27. void loop_up_to_int(int i)
  28. {
  29. j = 0
  30. while(j <= i)
  31. {
  32. printf("%d\n", j);
  33. j++;
  34. }
  35. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function 'main':
prog.c:9:9: warning: format '%d' expects a matching 'int' argument [-Wformat=]
  printf("Please enter in a positive int: %d");
         ^
prog.c: At top level:
prog.c:18:6: error: conflicting types for 'loop_down_to_zero'
 void loop_down_to_zero(int i)
      ^
prog.c:3:5: note: previous declaration of 'loop_down_to_zero' was here
 int loop_down_to_zero(int i);
     ^
prog.c:27:6: error: conflicting types for 'loop_up_to_int'
 void loop_up_to_int(int i)
      ^
prog.c:4:5: note: previous declaration of 'loop_up_to_int' was here
 int loop_up_to_int(int i);
     ^
prog.c: In function 'loop_up_to_int':
prog.c:29:2: error: 'j' undeclared (first use in this function)
  j = 0
  ^
prog.c:29:2: note: each undeclared identifier is reported only once for each function it appears in
prog.c:30:2: error: expected ';' before 'while'
  while(j <= i)
  ^
stdout
Standard output is empty