Code:
clear
clc
%2. Input a
string.
string = input('What is your string: ', 's');
%3. Check if the
string is a palindrome or not.
if string == fliplr(string);
disp (['The string, ' string ', is a palindrome.']);
else
disp (['The string, ' string ', is not a palindrome.']);
end
Output:
Leave a Comment