Computer Science Canada how to add a counter and a add 7 for this problem? |
Author: | batman12 [ Wed Jan 11, 2006 5:37 pm ] | ||
Post subject: | how to add a counter and a add 7 for this problem? | ||
hey, i'm back. hi i am back. hi i just created this solution but i don't know how to add a counter to count how manny numbers are divisible and how to add the nummber seven and do the same thing as 3 in the same problem?thanks. any help is aprreciated.thanks
|
Author: | chrispminis [ Wed Jan 11, 2006 5:47 pm ] | ||
Post subject: | |||
Well, to do it by 7's you could use remainders, although theres probably a better way. Then just add new variable and add to it when you find a number divisible by 7.
hope that helps |
Author: | Tony [ Thu Jan 12, 2006 3:31 pm ] | ||
Post subject: | |||
you could have incremental for loops
I think that's the syntax |
Author: | Geminias [ Fri Jan 13, 2006 5:42 am ] |
Post subject: | |
Quote: for count : 1..1000 if (count mod 3 = 0 ) then %i need to put number 7 here so it can do the same thing as three put " The number " , count , " is divisible by three " else if (count mod 7 = 0) then put " The number ", count, " is divisible by seven." end if end for put "There are 333 numbers divisible by three from 1 to 100." %i need help putting a counting that counts this for me without me counting it. if this is what you are talking about.. then this is how you do it lol. unless you have to check that they are either divisible by seven or three then you can just add "and" between the comparision statements. |