28 lines
541 B
C#
28 lines
541 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace 数组连加
|
|
{
|
|
class Program
|
|
{
|
|
static void Main(string[] args)
|
|
{
|
|
for (int i = 0; i <= 30; i++)
|
|
{
|
|
Console.WriteLine(getsum(i));
|
|
}
|
|
}
|
|
static int getsum(int n)
|
|
{
|
|
if (n < 2)
|
|
return 1;
|
|
else{
|
|
return getsum(n - 2) + getsum(n - 1);
|
|
}
|
|
}
|
|
}
|
|
}
|