Hello guys,
I am trying to make a code using a nested loop structure. How would I input a number and the output would be one line of asterisk?
I am trying to get my code to have an output like this:
enter int: 1
*
enter int: 2
**
enter int: 3
***
ect.
This is the code I have so far, but after you enter a int, it just counts the total lines I have specified.
import java.util.Scanner; public class Loop1 { public static void main(String[] args) { Scanner input = new Scanner( System.in ); String line; System.out.println("Please enter the total number of lines to output, as any integer greater than 0 and less than 71:"); line = input.next(); for(int x=0; x<71; x++){ for(int y=0; y<=x; y++){ System.out.print("*"); } System.out.println(""); } } }