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

#1 2013-02-18 10:32:45

PhilipCornell
New Scratcher
Registered: 2013-02-18
Posts: 2

Scratch algorithm help (BASIC)

The task states:
"You must create a program in Scratch where the sprite you choose asks you to enter a number. Once this number is entered you must allow the user to enter a second number.
You must then apply an algorithm that will let the user know if the smaller number is a factor of the bigger number or not."
We were given the hint that "mod" is required. This was our first lesson with Scratch so I'm pretty much clueless. Help, please? I just need help with the algorithm.

Offline

 

#2 2013-02-18 11:54:32

northmeister
Scratcher
Registered: 2011-07-12
Posts: 1000+

Re: Scratch algorithm help (BASIC)

when gf clicked
ask [First number?] and wait
set [answer 1 v] to (answer)
ask [Second number?] and wait
set [answer 2 v] to (answer)
set [number v] to <(answer 2) mod (answer 1)>
if <(number) = (0)>
say [The first number is a factor of the second number]
else
say [The first number is not a factor of the second number]
Tried and tested.  wink


http://i48.tinypic.com/5a25g5.png

Offline

 

#3 2013-02-18 12:06:13

PhilipCornell
New Scratcher
Registered: 2013-02-18
Posts: 2

Re: Scratch algorithm help (BASIC)

Thank You Very, Very Much!

Offline

 

Board footer