Computer Applications
Write the program in Java to display the first ten terms of the following series:
0, 1, 2, 3, 6,
Java
Java Iterative Stmts
109 Likes
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;
}
}
}
Variable Description Table
Program Explanation
Output
Answered By
45 Likes
Related Questions
Write the program in Java to display the first ten terms of the following series:
1, 11, 111, 1111,
Write the program in Java to display the first ten terms of the following series:
1, -3, 5, -7, 9,
Write the program in Java to display the first ten terms of the following series:
1, 12, 123, 1234,
Write the program in Java to display the first ten terms of the following series:
0, 3, 8, 15,