Question: Write a C program that uses only 1 scanf() statement and a while loop to do the following tasks: a. Display a prompt for a
Write a C program that uses only 1 scanf() statement and a while loop to do the following tasks:
a. Display a prompt for a persons height in inches and first name.
i. Include in the prompt the instruction to enter a q to quit the program.
b. Use a single scanf() statement in conjunction with a while loop to:
i. Read the persons height and first name.
ii. Convert the height in inches to a height in feet and inches using / and % operators.
1. There are 12 inches in a foot,
iii. Print out the persons name and height on 1 line.
1. Example output is: Nellies height is 5 foot 4 inches.
c. Demonstrate that your program works by entering 2 sets of heights and names and then enter a q to exit the program.
Remember that the return value from scanf() is the number of items that it read. The returned value can be used as part of a comparison expression
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
