输出 1,1,2,3,5,8,13,...........
public static int Main(string[] args)
{
for (int j = 0; j <= 29; j++)
{
Console.WriteLine(sum(j));
}
Console.ReadKey();
return 0;
}
public static int sum(int n)
{
int result;
if (n < 2)
{
result = 1;
}
else
{
result = sum(n - 1) + sum(n - 2);
}
return result;
}
浙公网安备 33010602011771号