• Post Reply Bookmark Topic Watch Topic
  • New Topic

Using For Loops to create Ascii Art  RSS feed

 
John Belceto
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I have been trying to create the following output for over an hour now. I'm looking of a suggestion, tip, or a little bit of code to start me off in the right direction. Below is the output I need to create.


 
Janeice DelVecchio
Bartender
Posts: 1812
12
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How would you talk through this on paper?

****** ////////////// ****** 0th line

looks like you start with 6 asterisks on each side, and you always have 14 slashes in the middle. right?

***** ////////////\\ ***** 1st line

now you have 5 asterisks and still 14 slashes, but the last 2 of them are the other direction....

Notice a pattern?

for each line, there's a mathematical formula to know both
-how many asterisks = ?
-how many of which direction slashes = ?

solve each equation and you solve your problem. then you should be able to write code.
 
Campbell Ritchie
Marshal
Posts: 56562
172
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have added code tags because they usually show that sort of output better than ordinary text.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!