How to store big values like pow(9,4000) ?

i want to store value of pow(9,4000) to a variable " num "
but i don’t know how to store such a large value
what data type should i use, i already tried to use unsigned long long int num; but it shows 0
any solution
C++ 4.8.1

You cannot do that simply. You can store its digits individually in a string/array though…

as u are using c++ u can even use vector stl.Offers a better option as adding digits and other operations are easier.

You are asking question from an ongoing contest.(PPOW from CodeSmart 2014). Please refrain.

3 Likes