In this code, the value of rr
is working properly only when i am using the printf
statement, otherwise the code is entering into the while loop even if rr
is actually an integer value, for example rr = 2.0
.
double rr = log(c)/log(2);
printf("Current value of rr is %lf\n",rr);
while(!(rr == (int)rr))
{
printf("hung in loop with c = %d\n",c);
if(c % 2 == 0)
c = c/2;
else
c = (c-1)/2;
rr = log(c)/log(2);
cc++;
}
This is the weirdest problem i have ever faced. The question is codechef august challenge problem 1.