Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke

1st Edition

0130086509, 978-0130086501

More Books

Students also viewed these Databases questions