No, I'm not going to sing. So there. Anyway, I am making a factorial program to help me w/ math; and I am noticing the lack of factorial blocks. And I would like to be able to post the project. Anybody know how to do this?
P.S. If possible, it needs to be able to compute multi-tier factorials, i.e. 5!!!.\
Thanks!
Offline
You can hack Scratch to do what you need very easily with some Squeak code. I would be surprised if the block library didn't have that code yet, so check there. However, this means you cannot upload the project online.
So if you want something to work for everyone, you can use a simple recurring script, as the example below shows for calculating 5 factorial:
set [input v] to (5) set [iteration v] to (1) set [value v] to (1) repeat ((input) - (1)) change [value v] by ((iteration) * (value)) change [iteration v] by (1) endThis yields the answer 120, which is correct.
Last edited by LS97 (2012-03-01 13:28:45)
Offline
Thanks, LS97! I originally used a custom block, but I wanted the upload ability.
Offline
technoboy10 wrote:
Thanks, LS97! I originally used a custom block, but I wanted the upload ability.
I see. Well, you're most welcome
Offline
Closed by request.
Offline