static void Main(string[] args) { Console.WriteLine("請輸入你要的數字:"); long flag = Convert.ToInt64(Console.ReadLine()); long result = MakeRusult(flag); Con ...
static void Main(string[] args)
{
Console.WriteLine("請輸入你要的數字:");
long flag = Convert.ToInt64(Console.ReadLine());
long result = MakeRusult(flag);
Console.WriteLine("結果是:{0}", Convert.ToString(result));
Console.ReadKey();
}
static long MakeRusult(long number)
{
if (number == 1 || number == 2)
{
return 1;
}
else
{
return MakeRusult(number - 1) + MakeRusult(number - 2);
}
}