• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Printing a triangle

 
Vivek Alampally
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Henry Wong
author
Marshal
Pie
Posts: 21007
77
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
 
Pushkar Choudhary
Rancher
Posts: 425
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
People have said enough about not giving solutions, I think.

Vivek Alampally, how far have you got?
 
Vivek Alampally
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 470
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could use http://faq.javaranch.com/java/UseCodeTags

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic