1,1,2,3,5,8,13到第n个数的列表

 

代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _112358 {
class Program {
static void Main(string[] args) {
Program gr
= new Program();
gr.getValues(
50);
Console.ReadLine();
}
public void getValues(int n) {
long i, j, k, temp;
j
= 1;
k
= 1;
temp
= 0;
for (i = 0; i < n; i++) {
if (i < 2) {
Console.WriteLine(
1);
}
else {
temp
= k;
k
= k + j;
j
= temp;
Console.WriteLine(k);
}
}
}
}
}

 

 

posted on 2010-11-22 09:26  卑鄙De小贝  阅读(340)  评论(0)    收藏  举报

导航