Question: need help programin this in C. Your task Write a program that prompts the user to draw one or more bars of a bar graph.

need help programin this in C.need help programin this in C. Your task Write a program that

Your task Write a program that prompts the user to draw one or more bars of a bar graph. To draw each bar, the program should prompt the user for a length, and then draw a bar with that many equals (-" characters. After drawing each bar, the program should ask whether or not to continue, and read a single input character. If the user enters a 'Y" or 'y' character, then the program should continue. If the user enters any other character, the program should finish. Example of running the program (user input in bold) length? 28 another? y length? 65 another? y length? 51 another? n Hints You will need nested loops. The outer loop will have the code to prompt for and draw a single bar. The inner loop will draw each character in a single bar. For each loop, you will need to choose between a while and a do/while loop. The rule is that if the loop should be able to execute 0 times, it should be a while. If it must be guaranteed to execute at least once, it should be a do/while You should start with a program that prompts for and draws a single bar. That code will then become the body of the outer loop that draws however many bars the user requests. You can use the following code to read a single character from the user and check whether it is "Y" or y": char answer; scanf(" %c", &answer); if (answer : "Y, 11 answer 'y') { // user entered Y or "y" else ( // user entered some other character Note that in the call to scanf there is a space before the %c

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!