# MULTIPLICATION PROGRAM:

8 messages
Open this post in threaded view
|

## MULTIPLICATION PROGRAM:

 I need help. I have no clue where to start in creating this multiplication program. Any suggestions?
Open this post in threaded view
|

## Re: MULTIPLICATION PROGRAM:

 Administrator For this one, pretty much any valid approach, no matter how inefficient, will work. So how would you teach a young child to multiply fairly small numbers together, such as 7 x 6? Think of how you might explain to them what multiplication is, in terms of addition.
Open this post in threaded view
|

## Re: MULTIPLICATION PROGRAM:

 I think I understand what you are saying and in my way I would teach a child to add 6 to 6 a amount of seven times. Of which would give an answer. But I guess I am confused now how to get the computer to loop seven times?
Open this post in threaded view
|

## Re: MULTIPLICATION PROGRAM:

 Administrator So this is progress. You have taken the original program and broken it down into a couple of simpler tasks. To multiply A by B, add A to a running total B times. So you need to be able to "add A to a running total" and you need to be able to do this "B times". The whole "multiplication" issue is solved; now you are focused on solving a simpler problem -- how to do something B times. So take a step aside and try to make a simpler program that does little more than do something B times. How about something like this: Given a value stored in R0, write a program that initializes R2 to zero and then adds 1 to the value in R2 a number of times equal to the value in R0. In other words, if R0 had 5 in it, then the value of R0 should go 0, 1, 2, 3, 4, 5 and then the program should stop. You know it works if the final value in R2 is always equal to the initial value that was in R0. How would you tell a child to do it if this child could only see the numbers written on a small number of index cards? What they can do with those cards is limited to the basic things that Hack hardware can do.
Open this post in threaded view
|

## Re: MULTIPLICATION PROGRAM:

 I was able to make a program that did a selected countdown from a certain number. Will that help?
Open this post in threaded view
|

## Re: MULTIPLICATION PROGRAM:

 Administrator Dan1984mor2017 wrote I was able to make a program that did a selected countdown from a certain number. Will that help? Yes, that program is a loop that executes a certain number of times and that number is determined by the value stored in a register. So how could you apply the ability to do that to achieve multiplication in which you add one number to a running sum a certain number of times and that number is determined by the value stored in a register?
Open this post in threaded view
|

## Re: MULTIPLICATION PROGRAM:

 I have been able to create a little program that will countdown from 10 or any input actual. But my program seems to keep adding the same numbers over and over again. It loops but does not loop the addition part. I'm confused.
Open this post in threaded view
|