-
trouble with loops
alright guys i am in my first java class and i am a complete newb.
my problem is a simple one i think. i just need to print a pyramid shaped triangle out of random integers 1-9, and the user input specifying the height.
this is the section i am having trouble with
input = keyboard.nextInt();
for (int i=1; i<=input; i++){
for (int j=1; j<=i; j++)
i have this which prints something like this
X
XX
XXX
i need it to look like this
X
XX
XXX
XX
X
any advice or help would be great
-
You have left off the part of your code that prints the output and that makes the decision on how many Xs to print on each line.
See my post on the other thread: http://www.java-forums.org/new-java/...tml#post144976