Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

program that prints the multiplication table up to one

 
tzio tzi
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1557
5
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
tzio tzi
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48404
56
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 10109
56
Eclipse IDE Hibernate Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
tzio tzi
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hehe good words
 
tzio tzi
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I got the solution

 
Winston Gutkowski
Bartender
Pie
Posts: 10109
56
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
tzio tzi wrote:I think I got the solution

Great!

And now comes the bit that everybody hates: TESTING.

Winston
 
tzio tzi
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It works great!
Thank you
 
Campbell Ritchie
Sheriff
Posts: 48404
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic