------解决方案-------------------- int x = 151, y = 50;
foreach (int i in Enumerable.Repeat(y, x / y).Concat(x % y == 0 ? new int[] {} : new int[] { x % y}))
Console.WriteLine(i); ------解决方案-------------------- int x = 151, y = 50;
while (x > 0)
{
Console.WriteLine(x);
x -= y;
} ------解决方案--------------------
丢人了,没实际做一下。。修改并debug确认过了
int x = 151, y = 50;
while (x > y)
{
Console.WriteLine(y);
x -= y;
}
Console.WriteLine(x); ------解决方案--------------------
int x = 151, y = 50;
while (x > 0)
{
Console.WriteLine((x > y ? y : x).ToString());
x -= y;
}