A little lost with for loops and making a design
Ask the user to enter a number between 4 and 20. If the user enters a number outside that range ask them for the number again. Based on the number the user enters, print a triangle of stars as in the following example:
If the user enters 5, your program would print the following:
So far, I've got the error checking alright, but I don't really know where to start with for the stars.
(except the alignment is to the right)
without the _
I'm assuming it involves a for loop, with a System.out.print(" "); System.out.print("*"); and a System.out.println("");
public static void main(String  args)
Scanner k = new Scanner(System.in);
System.out.println("Please enter a number between 4 and 20");
int num = k.nextInt();
while(num < 4 || num > 20)
System.out.println("Oops! Your number is not between 4 and 20, enter another one");
num = k.nextInt();
but any more than that I'm not sure..