更新时间:2023-02-10 09:46:51
我会做以下脚本。它更清晰可读。
I would do the following script. It is clearer and readable.
int i = 0;
int a = int.Parse(Console.ReadLine());
int b = int.Parse(Console.ReadLine());
for (i = a;i<b;i++)
{
if (i % 2 == 0)
{
Console.WriteLine(i);
}
}
希望有所帮助。
***的问候,
Carlos
Hope it helps.
best regards,
Carlos
从开始我
等于两者中的最小值并达到最大值:
Start withi
equal to the minimum of the two and go up to the maximum of the pair:
int min = Math.Min(a, b);
int max = Math.Max(a, b);
i = min;
while (i < max)
{
...
i++;
}