Results 1 to 2 of 2
Thread: trouble with loops
- 09-22-2010, 08:53 PM #1
Member
- Join Date
- Sep 2010
- Posts
- 2
- Rep Power
- 0
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
- 09-22-2010, 11:01 PM #2
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: Loop Help
Similar Threads
-
Help with loops!
By jrelvi23 in forum New To JavaReplies: 9Last Post: 09-04-2012, 01:36 PM -
these loops...
By Blaedel in forum New To JavaReplies: 0Last Post: 10-01-2009, 06:59 PM -
how to use do while loops
By mikeitalydz in forum New To JavaReplies: 32Last Post: 09-26-2009, 08:30 PM -
trouble creating program using loops for multiplication table
By cuse17 in forum New To JavaReplies: 2Last Post: 02-23-2009, 02:18 AM -
Loops (while do etc)
By manupr in forum New To JavaReplies: 1Last Post: 01-15-2008, 03:59 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks