class Program
{
static void Main(string[] args)
{
Console.WriteLine("请输入一个正整数:");
int a = Convert.ToInt32(Console.ReadLine());
while(a % 10 != 0)
{
int b = a % 10;
Console.Write(b.ToString());
a = a / 10;
}
Console.Read();
}
}
最简单的方法,不考虑输入的数是否为正整数
int input = Convert.ToInt32(Console.ReadLine());
while (input != 0)
{
int n = input % 10;
input = input / 10;
Console.Write(n);
}
Console.ReadKey();