the problem is- it is required to

store 'big integers'(more than alloted space for integers), suggest a

suitable method by which big integers can be stored , also device an

algorithm for adding of such numbers..


the just need the method of achieving this.i can write the code in any language i just need the logic

Recommended Answers

All 3 Replies

The logic is to store digits rather than the whole integer. then you do addition in the same way you used to do it when you where 10 years old, one column at a time.

Of course although you are storing digits you can choose the base to make effective use of your data type so rather than base 10 you could use something like base 65536 and use a 32bit int to store each digit.

thank u.. but is there a better method? according to above the program would be too long and complex. i am using C

No that is the best method in my opinion and its not very complex given that it only involves elementary school mathematics and lends itself easily to an iterative solution.

If you are using C why are you posting in C++?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.