
-----------------------------------
batman12
Wed Jan 11, 2006 5:37 pm

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 
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 "
    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. 

thnaks.

-----------------------------------
chrispminis
Wed Jan 11, 2006 5:47 pm


-----------------------------------
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.

if count rem 7 = 0 then
put " The number is currently divisible by seven"
countSevens := countSevens + 1 % You can also use countSevens += 1
end if


hope that helps

-----------------------------------
Tony
Thu Jan 12, 2006 3:31 pm


-----------------------------------
you could have incremental for loops

for i: 1 .. 100 by 7
    ...
end for

I think that's the syntax

-----------------------------------
Geminias
Fri Jan 13, 2006 5:42 am


-----------------------------------

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.
