search

Home  >  Q&A  >  body text

Another method, I don’t know if there is any error

public class SaveMoney {
/*** Xiaofang's mother gives her 2.5 yuan every day, and she will save it. Whenever she saves money on the 5th day or a multiple of the 5th day, she will spend 6 yuan. * Question: After how many days, can you save up to 100? Yuan * * Define the number of days, define the total amount of money money*/ public static void main(String[] args) {

int days=0;

double money = 0 ;

while(money<=100){

money =2.5;

days;

if(days%5==0){

                                                                                                                                                                                                                        # # }

System.out.println("Need" days "to save 100 yuan"); }

}

橄榄枝之恋橄榄枝之恋1807 days ago1125

reply all(0)I'll reply

No reply
  • Cancelreply