• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

program that prints the multiplication table up to one

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!

 
Bartender
Posts: 1558
5
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!

 
Marshal
Posts: 79151
377
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hehe good words
 
tzio tzi
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think I got the solution

 
Winston Gutkowski
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It works great!
Thank you
 
Campbell Ritchie
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic