C#实现输入整数后倒序输出

using System;
class Class1
{
static void Main()
{
Console.WriteLine(
"请输入一个整数:");
int x=Convert.ToInt32(Console.ReadLine());
int s=0;
while(x!=0)
{
s
=s*10+x%10; /*这是倒序的关键步骤*/
x
=x/10;            
}
Console.WriteLine(
"倒序后:");
Console.WriteLine(
"{0}",s);
}
}
posted @ 2011-09-11 23:23  BeFlyingWind  阅读(3005)  评论(0)    收藏  举报