Hey, I'm a beginner in scratch and I have to make something that will calculate a quotient of two numbers without using the division. I'm actually supposed to be using repeated subtraction to do it. I already had another assignment that I did repeated addition to do multiplication. I did this by making my sprite ask for number 1, and set the answer to a variable then ask for number 2 and set it to another variable, then I did
repeat (number two) times
change "product" by (number one)
Where "product" is a variable. And I made it spit out the answer.
I'm having a hard time getting the division part down using repeated subtraction. If someone could help me write the loop or something, that would help thanks.
Offline
james919 wrote:
Hey, I'm a beginner in scratch and I have to make something that will calculate a quotient of two numbers without using the division. I'm actually supposed to be using repeated subtraction to do it. I already had another assignment that I did repeated addition to do multiplication. I did this by making my sprite ask for number 1, and set the answer to a variable then ask for number 2 and set it to another variable, then I did
repeat (number two) times
change "product" by (number one)
Where "product" is a variable. And I made it spit out the answer.
I'm having a hard time getting the division part down using repeated subtraction. If someone could help me write the loop or something, that would help thanks.
repeat (number two) times
change "quotient" by (-1 * (number one))
Offline
You can check out my project that does this.
Script on this page.
Offline