The problem i am having is to get the loop and the counter to work,I can't see where the looping problem exists,, should my if statement be changed to a while or a for statement or should i abondan both and use an array?.. If i were to use an array how would i initialize it.Code:/* The Variables: n = the initial depth u = the height I can climb in 1 minute d = the number of feet I slip back during rest assume d < u and n < 100 a value of n = 0 indicates end of input Each input instance should generate a single line output to indicate the number of minutes it would take to climb out of the shaft. Sample input 10 2 1 Sample output 17 */ #include <stdio.h> #include <stdlib.h> int main() { int u,d,n,c = 0; int t,r,m,firsttry = t, firstrest = r, minutes = m , counter = c; printf("Enter your parameters\n",n,u,d); scanf("%d %d %d", &n, &u, &d); getchar(); if (n >100 ) // If you enter a number greater then 100 printf("You are dead dude"); // Your DEAD for (n != 0; c >= 0; c = c++)// If n is not equal to 0, then loop till it is { // c is the counter for m m = c ; t = n - u; // t is the attempts where depth minus climb = the new heigth r = t + d; // r is the distance I slip back while resting // where the try + the drop equals the new heigth //IF I put a print statement here we get the correct answer { // on the first try, so there is a problem with the loop//printf("%d", r); gives me 99 which is correct for the first dropgetchar(); if (r <= 0) // So if r is equal to 0, I am out of the shaft printf("It took %3.0f minutes", m); // display the counter m else // OR ELSE n = r; // r is given the value of n for the loop getchar(); } } return 0; }

Too many questons , my head hurts..lol sorry, any direction on this will be welcome.

Thanks a bunch...