private static void demo02() { int de = 20;//每天20 int ze = 0;//总钱数0 int days = 0; while(true) { days++; if(days%7==0) { ze=(ze+de)/2; } else { ze += (de/2); } System.out.print(ze+" "); if(ze==100) break; } System.out.println("要攒"+ze+"需要:"+days+"天"); } |
|