//有1分钱,2分钱,5分钱的硬币,要组合出来2角钱,有几种组合方式,分别各多少个 int count = 0; for (int y = 0; y <= 20;y++ ) { for (int e = 0; e <= 10;e++ ) { for (int w = 0; w <= 4;w++ ) { if(y+2*e+5*w==20) { count++; Console.WriteLine("第"+count+"种组合方法:1分钱"+y+"枚,2分钱:"+e+"枚,5分钱:"+w+"枚。"); } } } } Console.WriteLine("共有"+count+"种组合方法。"); Console.ReadLine();