//C# 求斐波那契数列的前10个数字 :1 1 2 3 5 8 13 21 34 55 using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleTest { class Program { static void Main(string[] args) { OutPut4(); } //方法1,使用while循环 public static vo
#打印斐波那契数列的第101项 a = 1 b = 1 for count in range(99): a,b = b,a+b else: print(b) 方法2: #打印斐波那契数列的第101项 a = 1 b = 1 for i in range(2,101): if i == 100: print(a+b) b += a a = b-a