Question: c program use a for loop Description This assignment is to write a program that will prompt the user to enter a character, e.g, a

 c program use a for loop Description This assignment is to c program use a for loop
write a program that will prompt the user to enter a character,

Description This assignment is to write a program that will prompt the user to enter a character, e.g, a percent sign (%), and then the number of that character they want on a line. Your program should first read a character from the keyboard, excluding whitespaces, and then print a message indicating that the number must be in the range 1 to 79 (both inclusive) if the user enters a number outside of that range. Your program should continue this behavior until you have received an appropriate integer. Use a loop to trap the user until you get the value that you want as you did in a previous assignment. You should also clear the keyboard buffer after each scanf so that the user can type characters or digits in their response. Once you have a number in the appropriate range, call a function that you write called drawLine that takes two arguments. One argument is the number of characters and the other argument is the character to draw. The function will use a for loop to draw that number of characters on the screen and then will print a newline. > run Please enter the character you want to draw: Please enter the number of characters you want in your line: -8 I'm sorry, that number is unrecoginized or out of range, try [1-79): why? I'm sorry, that number is unrecoginized or out of range, try (1-79): draw them! I'm sorry, that number is unrecoginized or out of range, try (1-79): ok, fine I'm sorry, that number is unrecoginized or out of range, try [1-79)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!