This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Formatting an output Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Formatting an output" Watch "Formatting an output" New topic

Formatting an output

Peter Haugen

Joined: Feb 08, 2013
Posts: 12
I have written a program that calculates the first 100 pentagonal numbers. The problem is that I am supposed to output the answers with 10 answers on each line of the output. I have no idea how to do this. I am guessing that I would want to write a loop and format the output in the loop??? Is any other way to format the output without writing another loop? Here is what I have so far...

Peter Haugen

Joined: Feb 08, 2013
Posts: 12
Bear Bibeault wrote:Please be sure to use code tags when posting code to the forums.

Thanks for letting me know and I will be sure to do this in the future.
Paul Clapham

Joined: Oct 14, 2005
Posts: 19856

I don't know why your guess involves a loop. The normal way to do something in Java is to call a method which does that thing.
I agree. Here's the link:
subject: Formatting an output
It's not a secret anymore!