Write the programs in Java to display the first ten terms of the following series: 0, 1, 2, 3, 6, ....
Answers
Answered by
0
Answer:
public class KboatTribonacci
{
public void displaySeries() {
int a = 0, b = 1, c = 2;
System.out.print(a + ", " + b + ", " + c);
for (int i = 0; i < 7; i++) {
int n = a + b + c;
System.out.print(", " + n);
a = b;
b = c;
c = n;
}
}
}
Explanation:
your output will be
0,1,2,3,4,5,6,7,8,9,10
Similar questions
Math,
4 hours ago
Math,
4 hours ago
Math,
8 hours ago
Math,
8 hours ago
English,
7 months ago
India Languages,
7 months ago
Social Sciences,
7 months ago