INPUT ATTEMPTS

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

Hello,

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,

Bruno

2 Likes

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:
http://discuss.codechef.com/questions/7349/computing-factorials-of-a-huge-number-in-cc-a-tutorial