A palindrome is a word which can be written in reversed order and it retains...

COMPUTER
WAEC 2022

A palindrome is a word which can be written in reversed order and it retains its meaning and spelling,Examples are lawal,ada,abba,etc

Write a simple QBASIC instruction that will accept a word from the keyboard and check if it is a palindrome or not. The palindrome must display a message showing if the word is palindrome or not.

Explanation

CLS

INPUT-ENTERANY:";S$

For l =LEN(S$) TO 1STEP-1

B$=MID$(S$,L,1)

W$=W$+B$

Next l

IF S$=W$ THEN

PRINT " it is palindrome"

ELSE

PRINT "It is not palindrome

END IF

END



Post an Explanation Or Report an Error
If you see any wrong question or answer, please leave a comment below and we'll take a look. If you doubt why the selected answer is correct or need additional more details? Please drop a comment or Contact us directly. Your email address will not be published. Required fields are marked *
Add Math
Don't want to keep filling in name and email whenever you make a contribution? Register or login to make contributing easier.