JAVA
java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
public class Fibo
{
static int f=0;
static int s=1;
static int t;
static int x=1000;
public static void main(String[] args)
{
System.out.print(Fibo.f+","+Fibo.s+",");
Fibo ob=new Fibo();
ob.recurr();
}
void recurr()
{
Fibo ob=new Fibo();
Fibo.t=Fibo.f+ Fibo.s;
Fibo.f= Fibo.s;
Fibo.s=Fibo.t;
if(Fibo.t< Fibo.x)
{
System.out.print(Fibo.t + ",");
ob.recurr();
}
else if(Fibo.t==Fibo.x)
{
System.out.print(Fibo.t);
OUTPUT
Run