Numbers on a computer have a finite range. You really ought to look at how integers and floating point numbers are stored--it's as fundamental as knowing data structures, you just can program without knowing this stuff.
A bignum library allows larger integers to be stored. To a web search for bignum and you'll be presented with a few implmentations.