package com.java.day03;
import java.util.Scanner;
/**
*
* @author Alfred
* @data 2018年7月21日下午3:30:24
* Description:计算斐波那契数列
* Version:1.1
*/
public class Demo02 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x=1,y=0,z=0;
System.out.print("请输入您要求的斐波那契数列的位数:");
int n=sc.nextInt();
for (int i = 1; i <= n; i++) {
if(i<=2) {
y=1;
System.out.print("1");
if(i<=1) {
System.out.print(",");
}
continue;
}
z=x+y;
System.out.print(","+z);
x=y;
y=z;
}
}
}