String choice = "y";
while(choice.equalsIgnoreCase("y")){
if (cents <= 99 && cents > 0){
quarters = cents / quarters;
System.out.println("Quarters: " + quarters);
dimes = cents / dimes;
System.out.println("Dimes: " + dimes);
nickels = cents / nickels;
System.out.println("Nickels: " + nickels);
pennies = cents / pennies;
System.out.println("Pennies: " + pennies);
我是否需要在每个步骤后实现模数运算符?
答案 0 :(得分:0)
啊,你有没有看到树木问题的木头。
老派伎俩叫做干跑
Cents Quarters Dimes Nickels Pennies Remaining Cents
41 1 16
16 1 6
6 1 1
1 1 0
你从每次计算开始。