You are viewing a single comment's thread. Return to all comments →
Another suggestion to reduce the number of loop iterations
for (int i=f;i*i<l;i+=f)
then double the count and add 1 if i*i==l
For the problem's testcase (f=4, l=16), won't your loop give count as 1 ?
why is it i*i?