I need for my output to be the first 100 pentagonal numbers, ten per row , counting in succession. As it stands my output just repeats itself, i am sure this is a simple answer but i cant seem to come up with it. This was homework and already graded but i would like to figure it out for me to learn. Thanks in advance for any input and help.
package chapter_5;
/**
*
* @author jason
*/
public class Five_One {
public static void main(String[] args) {
for (int k = 1; k < 11; k++) {
for (int n = 1; n < 11; n++) {
System.out.print(getPentagonalNumber(n)+ "\t");
}
System.out.println();
}
}
public static int getPentagonalNumber(int n) {
return n * (3 * n - 1) / 2;
}
}