Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ispalindrome(x:INTEGER):BOOLEAN is
- local
- forward : STRING
- reverse : STRING
- i1: INTEGER
- i2: INTEGER
- do
- forward:=x.to_string
- reverse:=copy(forward)
- from
- i1 := 1
- i2 := reverse.count
- until
- i1 >= i2
- loop
- reverse.swap(i1, i2)
- i1 := i1 + 1
- i2 := i2 - 1
- end
- if forward.is_equal(reverse) then -- compare if they are the same
- Result := True
- else
- Result := False
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement