how to print tribonacci series in java
Answers
Answer:
import java.util.*;
public class tribonacci
{
public static void main()
{
Scanner sc = new Scanner (System.in);
int a=0,b=1,c,d;
c=a+b;
d=a+b+c;
System.out.println(+a);
System.out.println(+b);
System.out.println(+c);
System.out.println(+d);
a=b;
b=c;
c=d;
d=a+b+c;
System.out.println(+d);
a=b;
b=c;
c=d;
d=a+b+c;
System.out.println(+d);
a=b;
b=c;
c=d;
d=a+b+c;
System.out.println(+d);
a=b;
b=c;
c=d;
d=a+b+c;
System.out.println(+d);
a=b;
b=c;
c=d;
d=a+b+c;
System.out.println(+d);
a=b;
b=c;
c=d;
d=a+b+c;
System.out.println(+d);
System.out.println(+d);
a=b;
b=c;
c=d;
d=a+b+c;
System.out.println(+d);
a=b;
b=c;
c=d;
d=a+b+c;
System.out.println(+d);
a=b;
b=c;
c=d;
d=a+b+c;
System.out.println(+d);
a=b;
b=c;
c=d;
d=a+b+c;
System.out.println(+d);
a=b;
b=c;
c=d;
d=a+b+c;
System.out.println(+d);
System.out.println(+d);
a=b;
b=c;
c=d;
d=a+b+c;
System.out.println(+d);
a=b;
b=c;
c=d;
d=a+b+c;
System.out.println(+d);
a=b;
b=c;
c=d;
d=a+b+c;
System.out.println(+d);
a=b;
b=c;
c=d;
d=a+b+c;
System.out.println(+d);
a=b;
b=c;
c=d;
d=a+b+c;
System.out.println(+d);
}
}