一个c#面试题()
代码
int a = 1;
int b = 10;
do
{
b -= a; //b=b-a;
a++;
Console.WriteLine("b={0},a={1}", b, a);
Console.WriteLine("==========\n");
}
while (b-- > 0) ;
Console.WriteLine(b);
Console.WriteLine(a);
Console.WriteLine(--b);
Console.WriteLine(b--);
Console.WriteLine(--b);
Console.ReadLine();
int b = 10;
do
{
b -= a; //b=b-a;
a++;
Console.WriteLine("b={0},a={1}", b, a);
Console.WriteLine("==========\n");
}
while (b-- > 0) ;
Console.WriteLine(b);
Console.WriteLine(a);
Console.WriteLine(--b);
Console.WriteLine(b--);
Console.WriteLine(--b);
Console.ReadLine();
请不要运行写出结果,然后把while(b-->0)改为while(b--<0)试试