以下是可能的各种情况,望采纳:
public class Money {
/** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub for(int i = 0;i <= 100;i++){ for(int j = 0;j <= 100;j++){ for(int z = 0;z <= 100;z++){ if((1 * i) + (2 * j) + (5 * z) == 100){ System.out.println("第" + i + "种情况: "+ "一分的硬币有: " + i + "枚; " + "二分的硬币有: " + j + "枚, " + "五分的硬币有: " + z + "枚"); } } } } }}