Im having difficulties on the first problem in this pset1. Specifically pennies.c.

So far I have done the first two requirements in the pset but Im stuck on the part where I have to double the pennies with the number of days the user inputs. I know it has to be a for loop and I also think is a combination of the while loop as well but I am not certain. I have been stuck for this problem for numerous days! I have tried working on this myself for while and Im finally asking for help on this one... Here is my code, I know asking for the days and pennies are right. The pennies pset is on pages 8 and 9<16. Thanks to all.

http://cdn.cs50.net/2011/fall/psets/1/pset1.pdf

- Code: Select all
`#include <cs50.h>`

#include <stdio.h>

int

main (void)

{

/* Gets the number of days in a month. */

long long days;

do

{

printf ("How many days in a month: ");

days = GetInt();

}

while ((28>days) || (31 < days)); /* Checks if the users input is valid. */

/* Gets the number of pennies in the first day */

long long pens;

do

{

printf ("How many pennies will you receive the first day: ");

pens = GetInt();

}

while (pens <= 0); /* Checks if the users input is valid. */

for (days = 1; days <= 31; days *=2);

long long total1;

{

for (pens = 0; pens <=31; pens *=2);

total1 = pens * days;

}

long long total2;

{

total2 = pens *= days * total1;

printf ("$%.2lld", total 2);

}

}