Question
A common punishment for school children is to write out the same sentence multiple times. Create a C program (punishment.c) that will write out the
A common punishment for school children is to write out the same sentence multiple times. Create a C program (punishment.c) that will write out the following sentence then number of times specified by the user: C programming language is the best! Your program will ask the user for the number of lines for the punishment: Enter the number of lines for the punishment: If an incorrect value has been entered, your program should output You entered an incorrect value for the number of lines! and stop executing. To make this program realistic, it will introduce a typo in a certain line. It will ask in what line a typo should be made by outputting Enter the line for which we want to make a typo:to the screen. Once again, you should check that the value entered by the user is correct (think about what would constitute an incorrect value). If the value is incorrect, display You entered an incorrect value for the line typo! and stop program execution. If both inputs are correct, you should then display the punishment sentence the correct number of times (C programming language is the best!), making sure to change it to C programming language is the bet!(the typo) for the line number defined by the user/input. You will need to use scan to process user inputs. Look it up online to find out how to use it.
// Program need to be written in C.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started