Question: Please make sure all spacing and formatting matches the sample runs. Use printf and scanf, Thanks! Create a C program that will write out the

Please make sure all spacing and formatting matches the sample runs. Use printf and scanf, Thanks!
Create a C program that will write out the following sentence the number of times specified by the user (without the quotes, unless explicitly mentioned): "Coding in C is fun and interesting!". Your program will ask the user for the number of times to output the punishment phrase using the following prompt (notice the space at the end of the prompt): "Enter the number of repetitions for the punishment phrase: ". If an invalid value is entered (think about what would constitute an invalid value), your program should output You entered an invalid value for the number of repetitions! and continue asking the user for an input till a valid one is entered. To make this program "realistic", it will introduce a typo during a certain repetition. It will ask for the repetition during which to introduce a typo using the following prompt: "Enter the line where you wish to introduce the typo: ". Once again, you should check that the value entered by the user is valid (think about what would constitute an invalid value). If the value is invalid, display You entered an invalid value for the typo placement! and continue asking the user for an input till a valid one is entered. When both inputs are correct, you should display the punishment phrase the correct number of times (Coding in C is fun and interesting!), making sure to change it to Cading in C is fun end intreseting! (the typo) during the repetition count defined/input by the user. You will need to use scanf to process user inputs. Look it up online to find out how to use it. Please see the sample runs below. Your program must produce an output that exactly resembles the Sample Runs, including identical wording of prompts, spacing, input locations, etc. Enter the number of repetitions for the punishment phrase: 4 Enter the line where you wish to introduce the typo: Cading in C is fun end intreseting! Coding in C is fun and interesting! Coding in C is fun and interesting! Coding in C is fun and interesting! Enter the number of repetitions for the puntshment phrase: 6 Enter the line where you wish to introduce the typo: Coding in C is fun and interesting! Coding in C is fun and interesting! Cading in C is fun end intreseting! Coding in C is fun and interesting! Coding in C is fun and interesting! Coding in C is fun and interesting! Enter the number of repetitions for the punishment phrase: 8 You entered an invalid value for the number of repetitionsi Enter the number of repetitions for the punishment phrase again: You entered an invalid value for the number of repetitions! Enter the number of repetitions for the punishment phrase again: 2 Enter the line where you wish to introduce the typo: You entered an invalid value for the typo placement! Enter the line where you wish to introduce the typo again: 3 you entered an invalid value for the typo placement! again: 2 Enter the line where you wish to introduce the typo again
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
