Large Integer numbers

Hi
Suppose I want to check divisibility of all number between 0 and (10^N)-1 where N is =100. Is there a way to do it because even unsigned long long int can not store it. Please Help

@mittalavi2001
You can only store maximum 18 digit numbers in long long int. That is the maximum any number data type can store in C++. 10^100 is straight 100 digits long and thus cannot be stored in any data type in C++. You can do these calculations in Python or by using BigInteger Class in Java as both of these allow you to store larger numbers. Alternatively you can use Boost libraries which are available for C++ which provide such larger number data types as well. These are available for free.
If you do not wish to go for any of these , the third way would be store the larger number in an array where each element of the array signifies one digit and the entire number denotes one single large integer number. This gets a little complicated to handle though however but it is the only way to go about this problem in C++ without using external libraries.

1 Like