Storing and displaying square of 11 digit integer

If we find the square of a 11 digit integer , the answer is in 21 digits or more, which even an unsigned long long int cant store . How can we calculate the square of such big numbers ? How to store and display such big numbers?

1 Like

you can get some idea from here …

BigInteger Class in Java can be really helpful in such circumstances, to a certain extent.

use long it will help istead of int

no largest value that can be saved in C/C++ using a datatype is 10^18 that too using unsigned long long…!! SO either you have to use an array or string… or code a big num class in c++

Is there no other way other than using array or strings in c?