Wednesday, October 16, 2019

QBASIC to find Palindrome word using FUNCTION

DECLARE FUNCTION PAL$ ( N$ )
CLS
INPUT "Enter any number"; N$
P$ = PAL$ ( N$ )
IF N$ = P$ THEN
PRINT  "The given word is Palindrome'
ELSE
PRINT " The given word is not Palindrome"
END IF
END

FUNCTION PAL$ (N$)
FOR I = LEN(S$) TO 1 STEP -1
B$ = MID$( N$, I, 1)
L$ = L$ + B$
NEXT I
PAL$ = L$
END FUNCTION

No comments:

Post a Comment