Now the penny a day results to $5,368,709.12. So i know I need to make a variable that will start at 1 and then double itself 30 times.
Im not entirely certain as to where to go from here. Heres what I have so far.
#include <stdio.h>
int main (void)
{
int x = 30;
for(x = 1; x = x*2;)
{
printf("$%d\n", x);
}
printf("\n");
return 0;
};
This code does what I intend it to do in principle. However, it needs some spring cleaning. After some trial and error of getting it to double 1 30 times (Well, 32 times in my case, which is unintentional) Ive succeeded, in a way.
Im hoping someone will pitch me some pointers as to how to display the money amounts correctly. (Dollars and cents)
Ive attached a .jpg of the compiled results as to help those who are interested in understanding what Im talking about.
This is part of my code for a homework assignment, and I know you guys wont do it for me. I feel like I've put forth a reasonable amount of effort though to get a helping hand.
Thanks,
blu

New Topic/Question
Reply




MultiQuote




|