fork download
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. /* variable definition: */
  6. int day;
  7. float amount, total saved;
  8. /* initialize */
  9. int day = 1;
  10. float amount = 0.0;
  11.  
  12. while(day<= 31){
  13. printf("day:%d \t amount:$%.2f \n", day, amount);
  14. amount *= 2;
  15. day = day +1;
  16. }
  17. return 0;
  18. }
  19.  
  20.  
  21.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
5.0
compilation info
prog.c: In function ‘main’:
prog.c:7:30: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘saved’
          float amount, total saved;
                              ^~~~~
prog.c:9:6: error: redeclaration of ‘day’ with no linkage
  int day = 1;
      ^~~
prog.c:6:14: note: previous declaration of ‘day’ was here
          int day;
              ^~~
prog.c:10:8: error: redeclaration of ‘amount’ with no linkage
  float amount = 0.0;
        ^~~~~~
prog.c:7:16: note: previous declaration of ‘amount’ was here
          float amount, total saved;
                ^~~~~~
stdout
Standard output is empty