| 
 | 
back to boardWrong answer 4! Please help! #include<stdio.h>   int main(void){     int n,k,time,n1,i;     scanf("%d%d",&n,&k);     i=1;     n1=1;     time=0;     while(n1<k && n1<n){         n1=n1+i;         i++;         time++;     }     if(n - n1>0){         if((n-n1) % k == 0)             time=time+(n-n1)/k;         else             time=time+(n-n1)/k+1;     }     printf("%d",time); return 0; } Re: Wrong answer 4! Please help! Hints:  1) your while loop condition is not quite right. 2) you are not growing n1 properly in the while loop 3) your "if (n - n1>0)" is not necessary, if n-n1 == 0 then the division result will be zero 4) integer ceiling of x/y can be done in a single step like this: (x + y - 1)/y 5) it's generally a good idea to finish each line of output with a newline character   In general: do some examples on paper, and step through your code in the debugger, or put in a bunch of print statements to follow the progress of the solution, and you'll discover where the problems are.    |  
  | 
|