Fibonacci number
public class Fibonacci
{
public static void main(String args[])
{
double f0=0, f1=1, f2=0, ratio=0;
for (int i=1; i<=100; i++)
{
f2=f0+f1;
ratio = f2/f1;
f0= f1;
f1=f2;
System.out.println(i+"\t"+f2+"\t"+" of the ratio is "+ratio);
}
}
}
0 Comments:
張貼留言
<< Home