Write a program in Java to print first 15 terms of Fibonacci series 0 1 1 2 3 5 8 13....
Answers
Answered by
0
Answer:
public class Exp1
{
public static void main(String args[])
{
int a=0,b=1,c;
System.out.print("Fibonacci Series: "+a+" "+b+" ");
for(int i=0;i<13;i++)
{
c=a+b;
a=b;
b=c;
System.out.print(c+" ");
}
}
}
Explanation:
0 1 1 2 3 5 8 13 21 34 55 89 144 233 377
Similar questions