This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Grokking Bitcoin and have Kalle Rosenbaum on-line!
See this thread for details.
Win a copy of Grokking Bitcoin this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

having problem getting the spaces right.  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


 
author
Posts: 23830
140
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, let me fixed the formatting of the topic for you ... which BTW, isn't it ironic that a topic about formatting is not formatted? ...

DONE... at least for the Java code. The ranch doesn't use a fixed width font for code (which is also the tag being used for the diamond), so it will be difficult to show the desired result for the diamond... but we kinda know what you mean.

Henry
 
Sheriff
Posts: 5924
155
Chrome Eclipse IDE Java Postgres Database Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please UseCodeTags (← that's a link) when posting your program. I'll do it for you this time. (Edit: or I'll let Henry do it.)
 
Knute Snortum
Sheriff
Posts: 5924
155
Chrome Eclipse IDE Java Postgres Database Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, there's a problem here, do you see it?

 
Knute Snortum
Sheriff
Posts: 5924
155
Chrome Eclipse IDE Java Postgres Database Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, write down how you want to the diamond to look and count the spaces before the stars. I've made an attempt here; you may want to change it.


Next, modify your program (or start over) so that it produces this output. Notice regularities in the spaces and stars.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Below will fix the format issue:

 
Marshal
Posts: 64130
215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

Unfortunately we do not believe that providing a complete answer helps the original poster to learn. Please look at what it says on the contents page for this forum:-

We're all here to learn, so when responding to others, please focus on helping them discover their own solutions, instead of simply providing answers.

Please don't be annoyed but I have pulled rank and shall delete your solution. Our forum software caches the original version in case it is ever needed again.
 
Cob is sand, clay and sometimes straw. This tiny ad is made of cob:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!