- 4
- 0
- 约1.55千字
- 约 2页
- 2017-06-11 发布于北京
- 举报
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ch05
{
class Program
{
static void Main(string[] args)
{
//int i = 2;
//int[] arr = new int[17];
//arr[0] = 1;
//arr[1] = 1;
//int count=0;
//while (true)
//{
// if (arr[i - 1] 1000)
// {
// arr[i] = arr[i - 1] + arr[i - 2];
// i++;
// }
// else
// {
// break;
// }
//}
//foreach (int c in arr)
//{
// if(c1000){
// Console.WriteLine(c);
// count+=c;
// }
//}
//Console.WriteLine(斐?3波?§那?契?数oy列¢D只?和¨a是o?:êo{0},count);
int i = 2;
int a = 1, b = 1, c = 0;
int count = 0;
Console.WriteLine(a);
Console.WriteLine(b);
while (true)
{
if (c 1000)
{
c = a + b;
if(c1000){
Console.WriteLine(c);
count += c;
}
a = b;
b = c;
}
else
{
break;
}
}
Console.WriteLine(斐?3波?§那?契?数oy列¢D只?和¨a是o?:êo{0}, count);
}
}
}
原创力文档

文档评论(0)