Write a Java program to print the following series:
0,1,2,3,6
Print 11 number in the series
Answers
Answered by
2
public class Tribonacci
{
public static void main ( String args [ ] )
{
int a = 0 , b = 1 , c = 2 , d = 0 ; System.out.print ( a + " " + b + " " + c ) ;
for ( int i = 1 ; i < = 11 ; i ++ )
{
d = a + b + c ;
System.out.print ( " " + d ) ;
a = b ;
b = c ;
c = d ;
}
}
}
Similar questions
Social Sciences,
1 month ago
Math,
3 months ago
Computer Science,
3 months ago
English,
9 months ago
Math,
9 months ago