Write a function which will take 2 arguments. They are: • Sentence • position Your first task is to take these arguments as user input and pass these values to the function parameters. Your second task is to implement the function and remove the characters at the index number which is divisible by the position (Avoid the index number 0 as it will always be divisible by the position, so no need to remove the index 0 character). Finally, add the removed characters at the end of the new string. Return the value and then finally, print the new string at the function call. ========== Input: "I love programming." 3 Function call: function_name("I love programming.", 3) Output: I veprgrmmngo oai.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter6: User-defined Functions
Section: Chapter Questions
Problem 19PE
icon
Related questions
Question
Write a function which will take 2 arguments. They are:
• Sentence
• position
Your first task is to take these arguments as user input and pass these values to the function parameters.
Your second task is to implement the function and remove the characters at the index number which is divisible by the position (Avoid the index number 0 as it will always be divisible by the position, so no need to
remove the index 0 character). Finally, add the removed characters at the end of the new string.
Return the value and then finally, print the new string at the function call.
Input:
"I love programming."
3
Function call:
function_name("I love programming.", 3)
Output:
I lveprgrmmngo oai.
Input:
"Python is easy to learn. I love python."
6
Function call:
function_name("Python is easy to learn. I love python.", 6)
Output:
Pythonis eay to earn.l lov pythn. sl eo
Transcribed Image Text:Write a function which will take 2 arguments. They are: • Sentence • position Your first task is to take these arguments as user input and pass these values to the function parameters. Your second task is to implement the function and remove the characters at the index number which is divisible by the position (Avoid the index number 0 as it will always be divisible by the position, so no need to remove the index 0 character). Finally, add the removed characters at the end of the new string. Return the value and then finally, print the new string at the function call. Input: "I love programming." 3 Function call: function_name("I love programming.", 3) Output: I lveprgrmmngo oai. Input: "Python is easy to learn. I love python." 6 Function call: function_name("Python is easy to learn. I love python.", 6) Output: Pythonis eay to earn.l lov pythn. sl eo
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Datatypes
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr