So we need to write a program where you input a number and the program generates a multiplication table that looks like a ramp going to the right, or a right triangle.
I have been able to generate a square table, but now I need to use an if statement to place a space instead of numbers to create the shape. I'm having a tough time figuring out what condition needs to be true to put a space instead of the number
import java.util.Scanner;
public class MultiTable {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int maxlength;
System.out.print("Please enter a positive max number: ");
maxlength = input.nextInt();
double multi;
for (int row = 0; row <= maxlength; row++) {
for (int count = 0; count <= maxlength; count++) {
multi = count * row;
System.out.printf("%3.0f ", multi);
}
System.out.println("");
}
}
}