Author |
Message |
blankout
|
Posted: Tue May 17, 2011 4:07 pm Post subject: anti-factorial program help |
|
|
I am trying to create an anti-factorial type program, however i am having some problems when it comes to ending the statement; I keep recieving an error regarding the = sign
PLEASE NOTE: i made this in about 5 minutes so i know its terrible coding and such
any help would be appreciated
Turing: |
%%%anit-factorial program%%%
var amount : real
get amount
cls
var divisor: int := 1
loop
put amount div divisor
divisor := divisor + 1
exit when (amount div divisor ) rem not = 0
end loop
|
P.S. i am using turing 4.1.1 |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
|
|
|
![](images/spacer.gif) |
blankout
|
Posted: Tue May 17, 2011 4:13 pm Post subject: RE:anti-factorial program help |
|
|
all i get told is syntax error at '=' |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Tue May 17, 2011 4:19 pm Post subject: RE:anti-factorial program help |
|
|
If it helps, you actual syntax error begins at rem |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
blankout
|
Posted: Tue May 17, 2011 4:20 pm Post subject: RE:anti-factorial program help |
|
|
ok thanks well i was trying to get the loop to exit when the remainder is not equal to zero, any help? |
|
|
|
|
![](images/spacer.gif) |
HRI
|
Posted: Tue May 17, 2011 4:25 pm Post subject: RE:anti-factorial program help |
|
|
rem is a binary operator. That means it takes two operands, much like + and -. |
|
|
|
|
![](images/spacer.gif) |
Raknarg
![](http://compsci.ca/v3/uploads/user_avatars/3745510004d8be6689b92f.jpg)
|
Posted: Tue May 17, 2011 5:16 pm Post subject: RE:anti-factorial program help |
|
|
Compare amount and divisor with rem instead. |
|
|
|
|
![](images/spacer.gif) |
|