PALINDROME WORD(FUNCTION)
DECLARE FUNCTION PAL$(N$)
CLS
INPUT "ENTER STRING";N$
P$=PAL$(N$)
IF N$=P$ THEN
PRINT "THE STRING IS PALINDROME"
ELSE
PRINT "THE STRING IS NOT PALINDROME"
END IF
END
FUNCTION PAL$(N$)
FOR I = LEN(N$) TO 1 STEP -1
B$= MID$(N$,I,1)
C$=C$+B$
NEXT I
PAL$=C$
END FUNCTION
CLS
INPUT "ENTER STRING";N$
P$=PAL$(N$)
IF N$=P$ THEN
PRINT "THE STRING IS PALINDROME"
ELSE
PRINT "THE STRING IS NOT PALINDROME"
END IF
END
FUNCTION PAL$(N$)
FOR I = LEN(N$) TO 1 STEP -1
B$= MID$(N$,I,1)
C$=C$+B$
NEXT I
PAL$=C$
END FUNCTION
Comments
Post a Comment