http://www.codechef.com/viewsolution/3646160

kindly help

at n=10000000000

its giving an answer of 99

while it should give 117â€¦

i am not able to understand the error which i have made.

Your approach is correct. The basic error in your code is that you have take the data type of the variable i as integer and then you are multiplying two integers and storing the result in long long int. But 10^5 * 10^5 would overflow integer and hence a negative value will go inside num (long long int) variable. Correct that error.

hey! thanks a lot it got accepted. thanku