WRITE A QBASIC PROGRAM TO PRINT PALINDROME WORD(FUNCTION)

QBASIC PROGRAM TO PRINT PALINDROME WORD


QBASIC PROGRAM TO PRINT PALINDROME WORD(FUNCTION)

Solution:


DECLARE FUNCTION REV$ (S$)
CLS
INPUT "ENTER ANY STRING"; S$
PRINT "PALINDROME WORD IS ";REV$(S$)
END

FUNCTION REV$ (S$)
FOR I = LEN(S$) TO 1 STEP -1
B$ = MID$(S$, I, 1)
W$ = W$ + B$
NEXT I
REV$ = W$
END FUNCTION