问一下第二题咋做啊!
解决方案
30
public static void main(String[] args){ int[] moneyArr = {100,50,20,10,5,1}; int myMoney = 78; for(int i=0;i<moneyArr.length;i++){ if(myMoney>=moneyArr[i]){ int count = myMoney/moneyArr[i]; myMoney = myMoney-moneyArr[i]*count; System.out.println(moneyArr[i]+","+count); } } }
JSP参照程序吧