Results 1 to 2 of 2
Thread: For Loop
- 08-07-2008, 10:54 AM #1Member
- Join Date
- Aug 2008
- Rep Power
Anyone know how to display a triangle in the
1) Center and pointing up position
2) Center and pointing down position
for(int i = 0; i < 5; i++)
for (int j = 0; j < 5; j++)
I have tried for hours but have no idea how to do.
- 08-07-2008, 02:01 PM #2
Take a piece of grid paper and draw in the figure you want.
Then for each row of the figure, do a println of a string with the *s spaced as per the drawing. For example for the point up, the first line would be a single centered *. As you move down there would be 2 *s with increasing spaces between then and decreasing spaces before and after them. The bottom line would be a row of *s all the way across.
- By Unknown1369 in forum New To JavaReplies: 5Last Post: 07-08-2008, 10:15 AM
- By Java Tip in forum java.langReplies: 0Last Post: 04-17-2008, 07:45 PM
- By Java Tip in forum java.langReplies: 0Last Post: 04-17-2008, 07:44 PM
- By eva in forum New To JavaReplies: 16Last Post: 01-31-2008, 07:44 AM
- By michcio in forum New To JavaReplies: 5Last Post: 01-27-2008, 01:56 AM