Computer Science, asked by venissa, 1 year ago

wap to print fibnacci series upto 20 terms

Answers

Answered by prakriti27
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;
}
}
}

prakriti27: mark as the best
Answered by ArchiJV
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
Similar questions