A palindrome is a word spelled the same way backwards and forwards. For example, Anna, radar,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
A palindrome is a word spelled the same way backwards and forwards. For example, Anna, radar, madam and racecar are all palindromes. Certain words can be turned into palindromes when the first letter is removed and added at the back, e.g. 'potato' will read the same backwards if we remove the 'p' and add it at the back, i.e. 'otatop' read backwards will still say 'potato'. Similarly, 'banana' when you remove the 'b' and add it at the back so that it becomes 'ananab' will still say 'banana' if you read it backwards. Write a program that reads a word into a C-string (a character array). The program should then determine whether the word would be a palindrome if we remove the first character and add it at the back of the word. Use only C-string functions and C-strings. Assume that we will not work with words longer than 20 characters. Hint: You may consider using the C-string function strrev () but it is not compulsory. Remember to plan your program! A palindrome is a word spelled the same way backwards and forwards. For example, Anna, radar, madam and racecar are all palindromes. Certain words can be turned into palindromes when the first letter is removed and added at the back, e.g. 'potato' will read the same backwards if we remove the 'p' and add it at the back, i.e. 'otatop' read backwards will still say 'potato'. Similarly, 'banana' when you remove the 'b' and add it at the back so that it becomes 'ananab' will still say 'banana' if you read it backwards. Write a program that reads a word into a C-string (a character array). The program should then determine whether the word would be a palindrome if we remove the first character and add it at the back of the word. Use only C-string functions and C-strings. Assume that we will not work with words longer than 20 characters. Hint: You may consider using the C-string function strrev () but it is not compulsory. Remember to plan your program!
Expert Answer:
Answer rating: 100% (QA)
Answer C PROGRAM include include include int main char word20 char newword20 printfEnter the ... View the full answer
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date:
Students also viewed these electrical engineering questions
-
A palindrome is a word or phrase that reads the same forward and backward, ignoring blanks and considering uppercase and lowercase versions of the same letter to be equal. For example, the following...
-
A palindrome is a string that reads the same forward and backward. Describe an algorithm for determining whether a string of n characters is a palindrome
-
Anna Banana Company would like to estimate how long it will take to realize cash from its ending inventory . For this purpose, the following data are submitted: Accounts receivable, less allowance...
-
Which of the following statements best describes the 'dilation' in rock mechanics? a. Movement of the rock along the shear direction during the direct shear tests b. Radial expansion of the intact...
-
To produce a recorded DVD, q = 1, a firm uses one blank disk, D = 1, and the services of a recording machine, M = 1, for one hour. a. Draw the isoquants for this production function and explain its...
-
Each of the double pulleys shown has a centroidal mass moment of inertia of 0.25 kg ?? m2, an inner radius of 100 mm, and an outer radius of 150 mm. Neglecting bearing friction, determine (a) The...
-
On June 8, 2017, Eugene Weiner made a post on Isaac Aflalos Facebook page. The post read, Yurim and Isaac took advantage of a old 94plus sick man elder abuse [sic]. Alflalo took umbrage to the post...
-
In Harley Company it costs $30 per unit ($20 variable and $10 fixed) to make a product that normally sells for $45. A foreign wholesaler offers to buy 4,000 units at $23 each. Harley will incur...
-
Assume the numbers in the diagram correspond to an area, A, in the bounded region in which they are contained. 1 9 8 2 4 5 3 What numbers make up the intersection of the circle, triangle, and square?
-
On December 31, Year 2, Palm Inc. purchased 80% of the outstanding ordinary shares of Storm Company for $350,000. At that date, Storm had ordinary shares of $240,000 and retained earnings of $64,000....
-
Go online and search for at least three companies that are considered great places to work Describe the compensation benefits and perks at each of these companies Of the three which is most appealing...
-
2. Which inventory control system uses an order of the same size each time?
-
You expect the following dividend distribution policy for SUPER Company: [1] The company will pay cash dividend $1 per share (per year) in next two years; [2] At the end of the third year, the...
-
(8 points) The following program is supposed to add two numbers to obtain the sum... but it does not work due to errors. How do you propose to fix the errors in the program so that variable "Result"...
-
All values USD millions. Sales/Revenue Cost of Goods Sold (COGS) incl. D&A COGS excluding D&A Depreciation & Amortization Expense Depreciation Amortization of Intangibles Gross Income SG&A Expense...
-
The Department of Health has announced its plans for a project to build a new hospital in Khayelitsha. In your view, are all the people of Cape Town stakeholders in this project? Explain your reasons.
-
A young start-up company and therefore is not paying any dividends on the stock over the next 5 years. At the end of year 5, the company will pay a $3 dividend. The company will pay a $3.25 per...
-
What is the difference between direct materials and indirect materials?
-
Consider the boolean expression((x > 10) || (x < 100)). Why is this expression probably not what the programmer intended?
-
Define an enumeration for each of the months in the year. Use a for-each statement to display each month.
-
Create a class that represents a grade distribution for a given course. Write methods to perform the following tasks: Set the number of each of the letter grades A, B, C, D, and F. Read the number of...
-
The marginal tax rate on a corporate income of \(\$ 87,000\) is closest to which of the following? a. 15 percent b. 20.5 percent c. 25 percent d. 34 percent
-
Calculate the corporate income tax for each of the following corporate taxable incomes. For each, determine the effective (average) tax rate and the marginal tax rate. a. $12,000 b. $65,000 c....
-
True or False: If the same amount of money is invested in something that can be expensed as in something that must be depreciated (and both provide the same annual returns) then you should choose the...
Study smarter with the SolutionInn App