
-----------------------------------
batman12
Tue Dec 20, 2005 8:07 pm

Mod command  problem? i keep on getting the same error?
-----------------------------------
hello,
i am a grade 10 kid and we are learning in turing in our computer engineering course. we have to make a program that displays all the numbers for 1 to 1000 that is divisible by three. i used for loop using mod but i keep on getting the same error.  any suggestion? thanks

my solution 
%description:show the user all the integers that are divisible by 3 and show the result. 
for count:1..1000  
if   ((count mod 3   ))=0),then
put " you can have",  count ,"that are divisble by three." 
end loop 


I get this error saying " syntax error at ')' expected 'then'"
please give me some suggestion that would help me out. i looked the at tutorials for for loops but didn't help me out. any sugggestions would be aprreciated. thanks.

-----------------------------------
iker
Tue Dec 20, 2005 8:33 pm


-----------------------------------
heres a suggestion: learn how to use
example
(var) is a variable
(n#) is a number

for (var) : (n1) .. (n2)
    if (n3) mod (n4) = 0 then
        put %words
    end if
end for


-----------------------------------
batman12
Tue Dec 20, 2005 8:43 pm


-----------------------------------
heres a suggestion: learn how to use
example
(var) is a variable
(n#) is a number

for (var) : (n1) .. (n2)
    if (n3) mod (n4) = 0 then
        put %words
    end if
end for
 it give me a error on the solution it gives me. can u please explain?thanks for the help iker.thanks.

-----------------------------------
Bored
Tue Dec 20, 2005 8:47 pm

Re: Mod command  problem? i keep on getting the same error?
-----------------------------------

my solution 
%description:show the user all the integers that are divisible by 3 and show the result. 
for count:1..1000  
if   ((count mod 3   ))=0),then
put " you can have",  count ,"that are divisble by three." 
end loop 


I get this error saying " syntax error at ')' expected 'then'"
please give me some suggestion that would help me out. i looked the at tutorials for for loops but didn't help me out. any sugggestions would be aprreciated. thanks.

first off you don't need the brackets around count mod 3 they do absoloutely nothing and when it say error at ')' expected then it means that where you have the '),' you should have then and just delete the '),' i have no idea why you have them there

-----------------------------------
Geminias
Tue Dec 20, 2005 10:15 pm


-----------------------------------

for count:1..1000 
if ((count mod 3 ))=0),then 
put " you can have", count ,"that are divisble by three." 
end loop 


syntax errors, put in simplest terms mean that there is an error in the format of your code.  Change it to..


for count : 1 .. 1000
    if count mod 3 = 0 then
        put "The number: ", count, " is divisble by three."
    end if
end for

[/code]
