fork download
  1. #include <stdio.h>
  2.  
  3. int main(void)
  4. {
  5. int day = 1;
  6. int money = 1;
  7. int total = 0;
  8.  
  9. while (total <= 10000)
  10. {
  11. total=total+ money;
  12. printf("%d日目までの合計金額 %d円\n", day, total);
  13.  
  14. money=money*2;
  15. day=day+1;
  16. }
  17.  
  18. return 0;
  19. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
1日目までの合計金額  1円
2日目までの合計金額  3円
3日目までの合計金額  7円
4日目までの合計金額  15円
5日目までの合計金額  31円
6日目までの合計金額  63円
7日目までの合計金額  127円
8日目までの合計金額  255円
9日目までの合計金額  511円
10日目までの合計金額  1023円
11日目までの合計金額  2047円
12日目までの合計金額  4095円
13日目までの合計金額  8191円
14日目までの合計金額  16383円