I wrote this program that prints a table that shows the powers of x, now i have to modify it so that it prints the sum of each row, after each row and i have no idea where to really start. i thought about putting the numbers into an array and adding them like that but that seems like its way too overly complicated.
public class table {
public static void main(String[] args)
{
final int NMAX = 5;
final double XMAX = 10;
for(int n = 1; n <= NMAX; n++)
{
System.out.printf("%10d", n);
}
System.out.println();
for(int n = 1; n <= NMAX; n++)
{
System.out.printf("%10s", "x ");
}
System.out.println();
for(double x = 1; x <= XMAX; x++)
{
for (int n = 1; n <= NMAX; n++)
{
System.out.printf("%10.0f", Math.pow(x, n));
}
System.out.println();
}
}
}