In C++ How to take a 20 digit number as an integer


You can declare a string and just read the entire number as if it was a string with gets() or similar function, then you can store each digit on an array (characters are actually numbers in the range 0-255) and perform operations over that array :slight_smile:

Best regards,



O.K If I get the input in form of string and store them in a integer array, then what can i do if i want to increment the given input for say some ‘n’ times…

To increment a very big number stored in an array you have to perform addition with arrays… I wrote a topic about representing large numbers in an array applied to the FCTRL problem, so maybe you can find some tips there to start :slight_smile: