aspose file tools
The moose likes Beginning Java and the fly likes Printing a triangle Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Printing a triangle" Watch "Printing a triangle" New topic
Author

Printing a triangle

Vivek Alampally
Ranch Hand

Joined: Jul 10, 2008
Posts: 65
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
Saloon Keeper

Joined: Jul 26, 2007
Posts: 7602

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


[Donate a pint, save a life!] [How to ask questions]
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 14606


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
Rancher

Joined: May 21, 2006
Posts: 416

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
Sheriff

Joined: Oct 13, 2005
Posts: 26710
People have said enough about not giving solutions, I think.

Vivek Alampally, how far have you got?
Vivek Alampally
Ranch Hand

Joined: Jul 10, 2008
Posts: 65
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
Posts: 470
You could use http://faq.javaranch.com/java/UseCodeTags

 
 
subject: Printing a triangle
 
Threads others viewed
Grid Routes
Nested Loops
UML multiple inheritance - domain model
Where Is the IT Hub in USA Second to the Silicon Valley?
Project Euler : problem 15
developer file tools

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture