Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Equation to find when a number is a multiple of 5?
- Username-a
- Scratcher
32 posts
Equation to find when a number is a multiple of 5?
https://scratch.mit.edu/projects/604141334
It is the second to last sprite that has the need for the equation. I have tried finding an equation for the past 20 minutes but have been unable to.
It is the second to last sprite that has the need for the equation. I have tried finding an equation for the past 20 minutes but have been unable to.
New project: One Sprite Pong: https://scratch.mit.edu/projects/658308916/
- Username-a
- Scratcher
32 posts
Equation to find when a number is a multiple of 5?
I believe I have found the solution
New project: One Sprite Pong: https://scratch.mit.edu/projects/658308916/
- Konserverad_gran
- Scratcher
70 posts
Equation to find when a number is a multiple of 5?
This is one possibility:
if <((number) mod [5]) = [0] > then
end
Last edited by Konserverad_gran (Dec. 2, 2021 12:39:01)
- WiktorMe
- Scratcher
9 posts
Equation to find when a number is a multiple of 5?
This is another possibility:
if <<(letter (length of (number)) of (number)) = [5]> or <(letter (length of (number)) of (number)) = [0]>> thenBut the option above is much simpler.
else
end
Last edited by WiktorMe (Dec. 2, 2021 17:06:36)
Hello! I make just about anything and everything.
“Logic will get you from A to Z; imagination will get you anywhere.” Albert Einstein
- deck26
- Scratcher
1000+ posts
Equation to find when a number is a multiple of 5?
For whole numbers only - so you'd have to check that as well unless you knew it was the case. The mod function is the better option. This is another possibility:if <<(letter (length of (number)) of (number)) = [5]> or <(letter (length of (number)) of (number)) = [0]>> then
else
end
- Discussion Forums
- » Help with Scripts
- » Equation to find when a number is a multiple of 5?