Question: Program 5 : Pennies for Pay (pennies.c Write a program that calculates how much a person would ean over a period of time if his

 Program 5 : Pennies for Pay (pennies.c Write a program that

Program 5 : Pennies for Pay (pennies.c Write a program that calculates how much a person would ean over a period of time if his or her salary is one penny the first day and two pennies the second day, and continues to double each day. The program should ask the user for the number of days. Display a table showing how much the salary was for cach day, and then show the total pay at the end of the period. The output should be displayed in a dollar amount, not the number of pennies. Do not accept a number less than 1 for the number of days worked (Use the do while loop for this). Test run Enter the number of days you worked: 5 Enter the number of days you worked: 0 Enter the number of days you worked: 15 0.01 0.02 0.04 0.08 0.16 0.32 0.64 1.28 2.56 5.12 10.24 20.48 40.96 81.92 163.84 2 5 6 7 8 9 10 12 13 14 15 Total 327.67 [kslottempress cs111 lec spr111s Hint Use a do-while loop to reject bad inputs. Usc a for loop to show the table. Inside the for loop, I have 3 statements. If your code doesn't work, double check the order of your statements inside the for loop. Make sure the total is NOT 327.68 No need to use a power function (pow))

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!