• 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
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

having problem getting the spaces right.

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


 
author
Posts: 23873
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux 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: 7039
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • 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: 7039
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • 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: 7039
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • 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: 68854
275
  • 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.
 
The first person to drink cow's milk. That started off as a dare from this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
    Bookmark Topic Watch Topic
  • New Topic