import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Fibbonancy {
/**
* @param args
* @throws IOException
* @throws NumberFormatException
*/
public static void main(String[] args) throws NumberFormatException, IOException {
int a=0,b=1,c;
System.out.println("enter the series of number..");
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int n=Integer.parseInt((br.readLine()));
System.out.print(a+","+b);
for(int i=0;i<n-2;i++){
c=a+b;
a=b;
b=c;
System.out.print(","+ c);
}
}
}
import java.io.IOException;
import java.io.InputStreamReader;
public class Fibbonancy {
/**
* @param args
* @throws IOException
* @throws NumberFormatException
*/
public static void main(String[] args) throws NumberFormatException, IOException {
int a=0,b=1,c;
System.out.println("enter the series of number..");
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int n=Integer.parseInt((br.readLine()));
System.out.print(a+","+b);
for(int i=0;i<n-2;i++){
c=a+b;
a=b;
b=c;
System.out.print(","+ c);
}
}
}
Comments