import java.util.*;
class Fibo
{
public static void main(String args[])
{
int sum=0,b=1;
System.out.println("Enter the Size of Fibonacci Series:");
Scanner f=new Scanner(System.in);
int n=f.nextInt();
System.out.println("Fibonacci Series:");
for(int i=1;i<=n;i++)
{
System.out.print("\t"+sum);
sum=sum+b;
b=sum-b;
}
}
}
class Fibo
{
public static void main(String args[])
{
int sum=0,b=1;
System.out.println("Enter the Size of Fibonacci Series:");
Scanner f=new Scanner(System.in);
int n=f.nextInt();
System.out.println("Fibonacci Series:");
for(int i=1;i<=n;i++)
{
System.out.print("\t"+sum);
sum=sum+b;
b=sum-b;
}
}
}
No comments:
Post a Comment