Tuesday, September 2, 2008

Palindrom

DECLARE FUNCTION Word$(w$, rev$)
CLS
INPUT "Enter a word"; w$
IF W$ = Word$(W$, rev$) THEN
PRINT W$; "Is palindrome"
ELSE
PRINT W$; "Is not a palindrome"
END IF
END

FUNCTION word$(w$, rev$)
FOR I = LEN (w$) TO 1 STEP -1
REV$ = REV$+MID$(w$, I, 1)
NEXT I
Word$ = Rev$
END FUNCTION

No comments: