Square digit squares: getting wa

kindly help :slight_smile:

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 :slight_smile: it got accepted. thanku :slight_smile: