I have a question:
Write a Scratch script to input a list of number one by one. The input should end by entering the word "done". Then, find out and display (by "say") the sum of all even numbers in the input list and also the sum of all odd numbers in the input list. (Note, the user should enter the list of numbers only once and your program should able to find out the required two pieces of information).
I can't show the even number and odd number and there is some bug when I add all the number too I know it's simple but I'm stupid Pls write a sample to me. Thx for your help!
Offline
I have a question:
Write a Scratch script to input a list of number one by one. The input should end by entering the word "done". Then, find out and display (by "say") the sum of all even numbers in the input list and also the sum of all odd numbers in the input list. (Note, the user should enter the list of numbers only once and your program should able to find out the required two pieces of information).
I can't show the even number and odd number and there is some bug when I add all the number too I know it's simple but I'm stupid Pls write a sample to me. Thx for your help!
Offline
First i would like to say that second paragraph is very negative.
Saying you cant do it and calling yourself stupid will only make you think that way, making it worse.
Second... can you upload the game so i can see the script you currently have? I would rather edit a script than start from 'Scratch'. (pun intended )
Thanks,
Pec
Offline
This belongs in Help with Scripts. I'll request to get it moved for you.
Offline
I can move it to Help with Scripts for you. Since it sounds like a homework assignment, I don't think we should just give you the scripts. But I can give you some help with the odd/even number issue.
One way to tell is to divide the number in two, round it to an integer, then multiply by two and see if you get the same number you started from. If you do, you have an even number
if <([2] * (round ((i) / (2)))) = (i)> say [Even!] for (1) secs else say [Odd!] for (1) secs endAnother way to do the same thing is to use the Mod function, which returns the remainder of a division
if < ((i) mod (2)) = (0)> say [Even!] for (1) secs else say [Odd!] for (1) secs end
Offline