Beginner, help with loop and variable
Hello, I'm trying to make a loop that will loop for the value that has been input and then continues to update a variable so that at the end it can spit out the total. The catch is I can't figure out how to update that variable. I am using C not C++ which has the new and delete. I looked around but haven't had any luck finding anything that I can understand. This is what I have so for:
Code:
for (int r=0; r<d; r++)
{
int q = (p*2);
int p = (q);
}
printf("At the end of the month your total is:\n");
printf("%d\n", p);
return 0;
Before I can update p I need a way to clear it. Any help would be great, thanks!