C How to Program (8th Edition)
8th Edition
ISBN: 9780133976892
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 21, Problem 21.13E
In some
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Write a program that prompts the user for a sentence and display in new words.
Your program should behave as follow:
1. Display a welcome message.
2. Ask the user for prompting a string with 3 words and 1 punctuation without any spaces.
3. Display the length of the string sentence.
4. Separate the words in the phrase
a. Prompt user for the length of each word
b. Display the complete sentence with the punctuation in the end.
5. Display a farewell message, so that the user knows that the program has terminated
normally.
Restrictions: No looping statements allowed (or needed). This question requires the use of the
functions: length(), substr() to generate the complete sentence.
Following are the sample screen shots to illustrate the expected behavior of your program. User
input at the keyboard is marked with a red circle. Your program should work with any sentence with
3 words entered by the user. Assume a perfect user who will always enter correct info.
Note: Your program must display…
Q. Hi andre
Write a Java program to check if a given string is a palindrome or not. A palindrome is a word, phrase, number, or other sequence of characters that reads the same backward as forward, ignoring spaces, punctuation, and capitalization.
For example, "racecar" and "Madam" are palindromes, while "hello" and "Java" are not.
Your program should take a string as input and return true if it's a palindrome, and false otherwise.
Ok.
6. A palindrome is a number or text
phrase that reads the same
backwards or forwards. For example,
each of the following five-digit integers
is a palindrome: 12321, 55555, 45554
and 11611. Write a program that
reads a 5 digit integer and determines
whether it is a palindrome. Hint: One
way to do this is to use division (/) and
modulus (%) operators to separate the
number into individual digits.
Chapter 21 Solutions
C How to Program (8th Edition)
Ch. 21 - (Write C++ Statements) Write a statement for each...Ch. 21 - (Inputting Decimal, Octal and Hexadecimal Values)...Ch. 21 - Prob. 21.8ECh. 21 - Prob. 21.9ECh. 21 - Prob. 21.10ECh. 21 - Prob. 21.11ECh. 21 - (Converting Fahrenheit to Celsius) Write a program...Ch. 21 - In some programming languages, strings are entered...Ch. 21 - Prob. 21.14ECh. 21 - Prob. 21.15E
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
How many "hello' output lines does this program print?
Computer Systems: A Programmer's Perspective (3rd Edition)
3.12 (Date Create a class called Date that includes three pieces Of information as data
members—a month (type ...
C++ How to Program (10th Edition)
Theater Seating Revenue with Input Validation A dramatic theater has three seating sections, and it charges the...
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
In the text, JUMP instructions were expressed by identifying the destination explicitly by stating the name (or...
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Repair Bill Suppose automobile repair customers are billed at the rate of per hour for labor. Also, suppose co...
Introduction To Programming Using Visual Basic (11th Edition)
Words that have predefined meaning in a programming language are called _____ .
Starting Out With Visual Basic (8th Edition)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Q1__;. A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers. Given a string s, return true if it is a palindrome, or false otherwise. Example 1: Input: s = "A man, a plan, a canal: Panama" Output: true Explanation: "amanaplanacanalpanama" is a palindrome. Example 2: Input: s = "race a car" Output: false Explanation: "raceacar" is not a palindrome..arrow_forwardWrite a program to: Store the following message into a string (DO include periods!):I am the door of the sheep. All who came before me are thieves and robbers, I am the door. Insert the following message after the comma in the string.but the sheep did not listen to them. Output the string to the screen with a new line at the end. Replace the following words in the string.a. “I” and "me" with “Jesus”b. “am” with “is”Note: Make sure you only replace the word “ am“ and not the letters “am" that might appear in that sequence in another word Output the string with a new line at the end. The final output should be as follows: Jesus is the door of the sheep. All who came before Jesus are thieves and robbers, but the sheep did not listen to them. Jesus is the door. Write in C++arrow_forwardExercise 1: A palindrome is a string of characters that reads the same for- wards as backwards. For example, the following are both palindromes: 1457887541 madam Write a program that prompts the user to input a string of a size 50 characters or less. Your program should then determine whether or not the entered string is a palindrome. A message should be displayed to the user informing them whether or not their string is a palindrome.arrow_forward
- What is a palindrome? A palindrome is a string that is the same when read left to right as when read right to left. Let's write a program that determines if an arbitrary string is a palindrome. Assume that the string can have blanks, punctuation, capital letters and lower case. Palindrome Examples: A man, a plan, a canal, Panama. Able was I 'ere I saw Elba. Madam, I'm Adam. Racecar Sample Program Output: Enter your palindrome or type quit:A man, a plan, a canal, Panama.Enter your palindrome or type quit:Be at a time I emit a beatEnter your palindrome or type quit:RacecarEnter your palindrome or type quit:A lad named E. MandalaEnter your palindrome or type quit:A Toyota's a ToyotaEnter your palindrome or type quit:Race and tell a dancerEnter your palindrome or type quit:quitPalindromes: A man, a plan, a canal, Panama. Racecar A lad named E. Mandala A Toyota's a ToyotaNOT Palindromes: Be at a time I emit a beat Race and tell a dancer *…arrow_forwardTake input a string s from the user and print the number of characters less than 's' in the string. String may contain any character. Programming Language- Javaarrow_forwardPlease &-. Write a Java program to check if a given string is a palindrome or not. A palindrome is a word, phrase, number, or other sequence of characters that reads the same backward as forward, ignoring spaces, punctuation, and capitalization. For example, "racecar" and "Madam" are palindromes, while "hello" and "Java" are not. Your program should take a string as input and return true if it's a palindrome, and false otherwise. Ik.?arrow_forward
- Exercise 1: Ask the user to type a string. Count and display the number of vowels (a,e,i,o,u). Print the string with all the vowels removed. Exercise 2: Cows cost $10 each, sheep cost $1 each and 8 hens can be bought for $1. Write a program which will buy exactly 100 animals for exactly $100 containing all three types (not just 100 sheep!)arrow_forwardWrite a program in Python in which the user enters a string of odd length and the program should print the middlemost character of the string in the output.arrow_forwardUsing java language, Write a program whose input is a character and a string, and whose output indicates the number of times the character appears in the string. The output should include the input character and use the plural form, n's, if the number of times the characters appears is not exactly 1.arrow_forward
- - 10. Given the variable language which contains a string, use if/elif/else to write a program that . return "I love snakes" if language is "pythan" (any kind of capitalization) • return "Are you a pirate? if language is "R" (any kind of capitalization) • else return "What is language ?" if language is anything else. U language = "python I Your answer here.arrow_forward1. Write a pyrhon program that prints out a classic hangman stick figure. The program should ask the user to enter a number from 1-6 and the corresponding hangman should be printed. The value the user inputs corresponds to the number of incorrect guesses in a real hangman game and so the completeness of the hangman will correspond to the number of ‘incorrect guesses’ inputted by the user (e.g., if the user enters 1, then only the head of the hangman will be printed; full example below). Example:Enter a number from 1-6: 1O Enter a number from 1-6: 2O|Enter a number from 1-6: 3O\||Enter a number from 1-6: 4O\|/|Enter a number from 1-6: 5O\|/|/Enter a number from 1-6: 6O\|/|/ \ 2. Modify your program from problem 1 so that the user input is checked to be a validsingle digit (1-6) before printing the corresponding hangman. If the input is not valid, theninstead of a hangman the following message should be printed “Invalid input: you must enter asingle number from 1-6.” Example:Enter a…arrow_forwardwrite a code snippet that can arrange the alphabet of a name entered by user in alternate case .note: ignore with spaces. Input string:Timothy olyphant . output string:TiMoThY OlYpHaNt. input string:Olga kurylenko. output string:OlGa KuRyLeNkO. by c language.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Dynamic Programming - Learn to Solve Algorithmic Problems & Coding Challenges; Author: FreecodeCamp.org;https://www.youtube.com/watch?v=oBt53YbR9Kk;License: Standard YouTube License, CC-BY