aspose file tools*
The moose likes Beginning Java and the fly likes Multiplication table from a file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Multiplication table from a file" Watch "Multiplication table from a file" New topic
Author

Multiplication table from a file

Matt Deg
Greenhorn

Joined: Mar 02, 2012
Posts: 7
I have a homework assignment that I am stuck on, we are to create a multiplication table from a file that we are given,

we were given this to start with....I got everything up to where I have to create the nested loop...any help on how to do this would be greatly appreciated




Thanks you

Update: Added Code tags. Please read UseCodeTags
Zeeshan Sheikh
Ranch Hand

Joined: Nov 20, 2011
Posts: 144

Logic for Nested Loop

for every value of table '1' run inner loop 10 times and output value to screen.




MySQL Blog
http://mysqlearner.blogspot.com/
Matt Deg
Greenhorn

Joined: Mar 02, 2012
Posts: 7
the output should be something like this

4 5 6
- - -
1 | 4 5 6
2 | 8 10 12
3 | 12 15 18



3 4 5 6 7 8 9
- - - - - - -
2 | 6 8 10 12 14 16 18
3 | 9 12 15 18 21 24 27
4 | 12 16 20 24 28 32 36
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36482
    
  16
I think you are trying to do too much at once. I think you ought to get something which prints out the numbers running, then later work out how to format them. A lot pf people try to do everything in one step, and that makes it difficult to do anything.
Victor M. Pereira
Ranch Hand

Joined: Mar 02, 2012
Posts: 50
where do you store the value your going to multiply?

If you had an array called values

the first for would print i + "| "
then the second for would multiply each value times i and print it
after the for you do a println() for sake of looks


regards,
Victor M. Pereira
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multiplication table from a file
 
Similar Threads
Printf and multi-dimensional array
HELP with sudoku puzzle
Need Help in Modification MultiRowHeaderExample
June Newsletter Puzzle
Need Help in Modification MultiRowHeaderExample