using System;
class Program
{
static void Main(string[] args)
{
Console.WriteLine("请输入一个数字:");
int a = int.Parse(Console.ReadLine());
for (; ; )
{
if (a % 2 == 0)
a = a / 2;
else
a = a * 3 + 1;
if(a==1)
break;
}
Console.WriteLine(a);
Console.ReadKey();
}
}
温馨提示:答案为网友推荐,仅供参考