aspose file tools*
The moose likes Beginning Java and the fly likes program that prints the multiplication table up to one Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "program that prints the multiplication table up to one" Watch "program that prints the multiplication table up to one" New topic
Author

program that prints the multiplication table up to one

tzio tzi
Greenhorn

Joined: Mar 14, 2012
Posts: 6
You should write a program that prints the multiplication table up to one, by the user defined boundary. Ask the user which is the highest factor should be.
I done this so far!

Anayonkar Shivalkar
Bartender

Joined: Dec 08, 2010
Posts: 1510
    
    5

Hi tzio tzi,

Welcome to CodeRanch!

Please UseCodeTags.

Further, what is your exact question? Is the code giving you error? Is it not working as expected? Or are you stuck with what to do next?

Please let us know what is actual issue.

Thanks.


Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
tzio tzi
Greenhorn

Joined: Mar 14, 2012
Posts: 6
Hi and thank´s for your response!

My problem is that I have to change the code so that the user can tell the program which factor that should be the highest one. An example: if the user tells the program that the highest factor should be 4, then the result should be: 1 2 3 4
2 4 6 8
3 6 9 12
4 8 12 16

Thank´s in advance!

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39869
    
  28
Pencil and paper. That’s what you need. Write down very simply how you intend to create such a table. Then you will find it easy to convert to code. I think what you are doing will create a single column, whereas you want multiple columns.
tzio tzi
Greenhorn

Joined: Mar 14, 2012
Posts: 6
Thanks for the responce once again!
can you please give an example?
Iam so stuck in my head right know that I can´t tell the differens between apple and
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 8244
    
  23

tzio tzi wrote:Thanks for the responce once again!
can you please give an example?

You've already given one yourself, so you clearly have more knowledge about what you want than we do.

I am so stuck in my head right know that I can´t tell the differens between apple and

And the reason, almost certainly, is because you're trying to code before you've thought out the steps you need to follow.

My advice (and the first two steps are the same I give to all newbies):
1. STOP CODING.
2. Turn your computer OFF.
3. Do what Campbell suggested in his post.
4. DON'T turn your computer back on until you completely understand all the steps you wrote out in step 3.

Winston


Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
tzio tzi
Greenhorn

Joined: Mar 14, 2012
Posts: 6
Hehe good words
tzio tzi
Greenhorn

Joined: Mar 14, 2012
Posts: 6
I think I got the solution

Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 8244
    
  23

tzio tzi wrote:I think I got the solution

Great!

And now comes the bit that everybody hates: TESTING.

Winston
tzio tzi
Greenhorn

Joined: Mar 14, 2012
Posts: 6
It works great!
Thank you
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39869
    
  28
You’re welcome

But I don’t think it will work correctly, nor that you have an optimal solution. You said you wanted a square output, but you won’t reliably obtain a square. I don’t think you need that array at all.
I would also recommend you find out about printf, which can make your display much better.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: program that prints the multiplication table up to one