Question

Write a MATLAB program that requests the user to enter a word and checks if the...

Write a MATLAB program that requests the user to enter a word and checks if the word is a palindrome or not.
Test the program with following inputs.
1. racecar 2. Levels 3. civic
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:

str = input(' Enter a word' , ''s')

if str == fliplr(str)

display(['The string ' str ' is a palindrome'])

else

display('[ String is no palindrome'])

end

Sample runs:

1

2

3

------------------------------------------------------------------------------------------------------------------------------

Add a comment
Know the answer?
Add Answer to:
Write a MATLAB program that requests the user to enter a word and checks if the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • – Palindrome Game Please write a Java program to verify whether a given word is a...

    – Palindrome Game Please write a Java program to verify whether a given word is a palindrome. You must stop your program when the user enters ‘@’ character as the word. You may write a recursive program to solve this game, but you don’t have to. You may use a stack and/or a queue to solve this game, but you don’t have to. You must run 3 test cases for your program.   Your test case #1 must look as follows:...

  • Write a C Program that asks the user to input a string and then the user...

    Write a C Program that asks the user to input a string and then the user is prompted back whether the input string is a “Palindrome Word” or not. (A Palindrome Word reads the same backward or forward, eg. madam, racecar, etc.) Your program should contain a function that accepts the input string from the main function and returns a value indicating whether the input string is a Palindrome or not. Use Pointers to traverse the string.

  • 2. Write a program that takes a word that a user enters into a textbox, and...

    2. Write a program that takes a word that a user enters into a textbox, and displays the word reversed in an output text box. If the word is a palindrome (if the reversed word is the same as the initial word like mom, dad, anna), have a message box appear saying the word entered is a palindrome. You may use either a pretest or posttest do loop. Change werd ChangeWord Word apple Word: hannah Flp Word Backwards Result elppa...

  • Write a program that asks the user to enter a password, and then checks it for...

    Write a program that asks the user to enter a password, and then checks it for a few different requirements before approving it as secure and repeating the final password to the user. The program must re-prompt the user until they provide a password that satisfies all of the conditions. It must also tell the user each of the conditions they failed, and how to fix it. If there is more than one thing wrong (e.g., no lowercase, and longer...

  • Your program must prompt the user to enter a string. The program must then test the...

    Your program must prompt the user to enter a string. The program must then test the string entered by the user to determine whether it is a palindrome. A palindrome is a string that reads the same backwards and forwards, such as "radar", "racecar", and "able was I ere I saw elba". It is customary to ignore spaces, punctuation, and capitalization when looking for palindromes. For example, "A man, a plan, a canal. Panama!" is considered to be a palindrome....

  • write a program C++ that asks a user to enter a word from the following list...

    write a program C++ that asks a user to enter a word from the following list (turtle, tree, tin). If they entered the word turtle, tell them they picked an animal. If they entered the word tree, tell them they picked a plant. If they entered the word tin, tell them they picked a mineral. If they did not enter one of these words, output an error message.

  • Write a C program as follows: Single source code file Requests the user to input two...

    Write a C program as follows: Single source code file Requests the user to input two integer numbers Requests the user to make a choice between 0 (add), 1 (subtract), or 2 (multiply) Declares three separate functions Uses a pointer to these three functions to perform the requested action Outputs the result to the screen Submit your program source code file to this assignment. Sample Output Enter first integer number: 15 Enter second integer number: 10 Enter Choice: 0 for...

  • C language: Write a program that uses a function to check if a user entered string...

    C language: Write a program that uses a function to check if a user entered string is a palindrome. Based on the return value of the function, the results are printed in the main() function. (do not print results in function to check for palindrome) A palindrome reads the same forward as backward for example tacocat or civic.

  • Write a function palcheck (char word II) which takes a C-style string word (or a C++...

    Write a function palcheck (char word II) which takes a C-style string word (or a C++ string word if you wish) and returns or false depending on whether or not the string is a palindrome. (A palindrome is a string which reads the same backwards and forwards. Some classic example of palindromes are radar, racecar, toot, deed, bib, civic, redder and madam.) Use your function from part (a) in a complete C++ program which, for each small letter 'a' through...

  • Write a program that prompts the user to enter an integer and checks whether the number...

    Write a program that prompts the user to enter an integer and checks whether the number is divisible by both 5 and 6, divisible by 5 or 6, or just one of them (but not both). SAMPLE OUTPUT Enter an integer: 10 Is 10 divisible by 5 and 6? False Is 10 divisible by 5 or 6? True Is 10 divisible by 5 or 6, but not both? True (Python programming language)

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT