121k views
24 votes
JAVA

Write a program to display the first ten terms of the series:
5, 10, 17, --------------​

1 Answer

8 votes

Answer:

class Main {

public static void main(String args[]) {

int a = 5;

int delta = 5;

for(int i=0; i<10; i++) {

System.out.printf("%d, ", a);

a += delta;

delta += 2;

}

}

}

User Chip Uni
by
4.6k points