I'm beginning to learn C lately, and I now realize how frustrating it can be.
I am writing a program that calculates the wages of an employee if they were to receive 1 penny for the first day of work, 2 pennies for their second day, and then double that for the third day, etc, etc.
I wrote the beginning statements, asking the user to input the amount of days to be calculated, and now I have to write a looping statement. But I'm stuck at what to put as a mathematical expression that'll calculate the amount of pennies.
Also, the amounts must be displayed in dollar amount, in a chart like...
Day# Wages
--------------------------------------...
1 0.01
2 0.02
3 0.04
4 0.08
I realize that there's an exponential pattern within the penny amount, and I tried everything I could to get that working...I was then thinking about maybe putting in a nested loop to configure the dollar amount...I don't even know.
Can anyone help?
I'm just a beginner, so go easy on me.
Tags: