The most intelligent Java IDE
[Logo] JavaRanch » JavaRanch Saloon
  Search | FAQ | Recent Topics | Hot Topics
Register / Login


Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » Beginning Java
 
RSS feed
 
New topic
Author

Printing a triangle

Vivek Alampally
Greenhorn

Joined: Jul 10, 2008
Messages: 17

I am trying to a write a program which prints a triangle as shown below
*
**
***
****
*****
Can anybody tell me how to do it in java?
Maneesh Godbole
Bartender

Joined: Jul 26, 2007
Messages: 4244

If you are looking for a ready made solution, you are at the wrong place.
Show us what you have got so far, tell us where you are stuck and we will help point you in the right direction

work is the scourge of the drinking class
Henry Wong
author
Bartender

Joined: Sep 28, 2004
Messages: 10022


Generally, starting with what you just learned is a good idea. I am assuming that you just learned about loops prior to this homework assignment. Start from there...

Henry

Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Pushkar Choudhary
Ranch Hand

Joined: May 21, 2006
Messages: 353

Vivek Alampally wrote:Can anybody tell me how to do it in java?

In case you are not sure why Maneesh is saying:
Maneesh Godbole wrote:If you are looking for a ready made solution, you are at the wrong place.

read this and this.
Campbell Ritchie
Bartender

Joined: Oct 13, 2005
Messages: 14987

People have said enough about not giving solutions, I think.

Vivek Alampally, how far have you got?
Vivek Alampally
Greenhorn

Joined: Jul 10, 2008
Messages: 17

Actually I wanted to print a different triangle(Here at the time of posting, forum editor is eliminating all the spaces) . But it is not possible here to show you all what I actually wanted to print
Misha Ver
Ranch Hand

Joined: Mar 03, 2008
Messages: 244

You could use http://faq.javaranch.com/java/UseCodeTags

 
 
 
Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » Beginning Java
 
RSS feed
 
New topic
replay challenge