Square digit squares: getting wa

wa

#1

http://www.codechef.com/viewsolution/3646160
kindly help :slight_smile:


#2

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.


#3

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.


#4

hey! thanks a lot :slight_smile: it got accepted. thanku :slight_smile: