This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-09-20 22:12:23

james919
New Scratcher
Registered: 2011-09-20
Posts: 2

Repeated Subtration/Division ?

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

 

#2 2011-09-21 07:49:14

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: Repeated Subtration/Division ?

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

 

#3 2011-09-21 08:47:47

sci_test
Scratcher
Registered: 2011-06-22
Posts: 100+

Re: Repeated Subtration/Division ?

You can check out my project that does this.  smile
Script on this page.


[signature removed - please be respectful]
Last edited by scimonster (1970-01-01 00:00:00)

Offline

 

#4 2011-09-21 17:26:27

james919
New Scratcher
Registered: 2011-09-20
Posts: 2

Re: Repeated Subtration/Division ?

Thanks, I finally got it with some tweaking

Offline

 

Board footer