wap to print fibnacci series upto 20 terms
Answers
Answered by
1
class Fibonacci
{
void main()
{
System.out.println("*****Fibonacci Series*****");
int f1, f2=0, f3=1;
System.out.print(f2);
for(int i=1;i<=20;i++)
{
System.out.print(" "+f3+" ");
f1 = f2;
f2 = f3;
f3 = f1 + f2;
}
}
}
{
void main()
{
System.out.println("*****Fibonacci Series*****");
int f1, f2=0, f3=1;
System.out.print(f2);
for(int i=1;i<=20;i++)
{
System.out.print(" "+f3+" ");
f1 = f2;
f2 = f3;
f3 = f1 + f2;
}
}
}
prakriti27:
mark as the best
Answered by
0
//TO PRINT FIBNACCI SERIES UPTO 20 TERMS
class Fibonacci
{
void main()
{
System.out.println("*****Fibonacci Series*****");
int f1, f2=0, f3=1;
System.out.print(f2);
for(int i=1;i<=20;i++)
{
System.out.print(" "+f3+" ");
f1 = f2;
f2 = f3;
f3 = f1 + f2;
} end of for
} end of main()
}end of class
class Fibonacci
{
void main()
{
System.out.println("*****Fibonacci Series*****");
int f1, f2=0, f3=1;
System.out.print(f2);
for(int i=1;i<=20;i++)
{
System.out.print(" "+f3+" ");
f1 = f2;
f2 = f3;
f3 = f1 + f2;
} end of for
} end of main()
}end of class
Similar questions