Question: Define a function in MATLAB which tells the user whether a 5 - digit - integer given as an input is a palindrome or not.

Define a function in MATLAB which tells the user whether a 5-digit-integer given as an input is a palindrome or not.
Priorly, we need to verify that the number provided by the user is a scalar, an integer, and has exactly 5 digits (not more, not less).
A number is said to be a palindrome if the number formed by reversing the order of its digits is the same as to the original number.
Example: 17071,22522,86368, and 11111 are palindromes.
Example: 12341,11233,32525, and 10000 are not palindromes.
The built-in functions: str2num(), num2str(), flip(), fliplr(), and strcmp() are NOT allowed.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!