Question: Write a C program to ask the user for an integer n, loop n times. Each time, ask the user for a char, check that

Write a C program to ask the user for an integer n, loop n times. Each time, ask the user for a char, check that the input received is that type, and then either terminate with an error message or ask for another input until the user has given n correct inputs.

The output of this program should look like this, assuming that the user gives n = 2 correct inputs of type char:

Hello! How many chars should I take? 2 Please give me a char: a

Thanks! Please give me another char: b Thanks! I am happy with 2 chars.

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!