//for循环编译斐波那契数列,选择打印多少值。
Scanner sc = new Scanner(System.in);
System.out.println("请输入要打印的斐波那契数列的个数");
int count = sc.nextInt();
int x = 1;
int y = 1;
int z = 0;
for (int i = 1;i <= count;i++){
//输出数列的前两项
if(i == 1 || i== 2){
System.out.print(1+"\t");
}else {
//第三项之后,前两项之和等于第三项
z = x + y;
x = y;
y = z;
System.out.print(z+"\t");
}
}```