已知本金为1000元,年利率为3.5%,试求存入银行多少年后本利和翻一番。double money = 1000;//金额int years = ____;//用于存储年数while (____){years++; money = money + money * 0.035;//本利和} System.out.println("需要%d年", years);
请输入密码及确认密码,如果两次密码不一致,则重新输入,直至密码一致,输出“密码设置成功”String pwd1 = "";//pwd1存储密码String pwd2 = "";//pwd2存储确认密码Scanner sc =new Scanner(System.in);do{System.out.println("请输入密码:");pwd1=____;System.out.println("请再次输入密码:");pwd2=____;} while(____);System.out.println("密码设置成功!");
计算1+2+3+…100。int i = 1;//存储项int sum = 0;//存储和 do{____;____;} whil (i <= 100);System.out.println("和为:" + sum);
1. 已知本金为1000元,年利率为3.5%,试求存入银行多少年后本利和翻一番。____money = 1000;int year =0;while ( money<2000 ){____; money = money + money * 0.035;} System.out.println("需要" + year + "年");