标签:打印 rgba next else rgb 循环 == 数列 tin
1 Scanner sc = new Scanner(System.in); 2 System.out.println("请输入要打印的斐波那契数列的个数"); 3 int count = sc.nextInt(); 4 int x = 1; 5 int y = 1; 6 int z = 0; 7 for (int i = 1;i <= count;i++){ 8 //输出数列的前两项 9 if(i == 1 || i== 2){ 10 System.out.print(1+"\t"); 11 }else { 12 //第三项之后,前两项之和等于第三项 13 z = x + y; 14 x = y; 15 y = z; 16 System.out.print(z+"\t"); 17 18 } 19 }
标签:打印 rgba next else rgb 循环 == 数列 tin
原文地址:https://www.cnblogs.com/Ming-qi/p/13828385.html