Posted: Thu Oct 30, 2003 5:16 pm Post subject: (No subject)
umm... you'd have to use a reversed for loop and use two variables.... thats the easiest way
ex:
code:
var word1,word2:string(30):=""
word:="mom"
for decreasing i:1..length(word1)
word2+=word1(i)
end for
if (word1 = word2) then
%is a palindrome
end if
thats just one way, theres more but i think thats the easiest...
Andy
Posted: Thu Oct 30, 2003 5:31 pm Post subject: (No subject)
you could also do this
code:
var word :string:="mom"
for i:1..length(word) div 2
for decreasing j: length(word)..length(word) div 2
if word(i) not= word(j)
put "no"
return
end if
end for
end for
better than blade's method cuz u dont need a new var
Blade
Posted: Sun Nov 02, 2003 1:41 am Post subject: (No subject)
Blade wrote:
thats just one way, theres more but i think thats the easiest...