1 / 12
Nov 2010

In the Small Factorials problem, I confronted with the follow problem: how can I represent factorial of the 100? Which data type I use to represent this factorial in C language?? How to print this data type??

There is no basic datatype that will hold a number that large accurately. However arrays can be as big as you would like them to be, as long as they don't exceed memory contraints.

1 month later

can u specify which data type will work for c in this particular problem as i am also facing the similar problem

20 days later

Anybody would might put one example to represent a integer greater than 64 bit?

char a[100000], b[100000];
add(a,b);

You need to write the function for add.

Ok. Well, imagine you need to operate two big integer values, for example, + or *.
How can I do such operation with theses values in string format?? These point I don`t understand...

If you had nothing but a pencil and paper how would you do it?

a[0] - '0' is the digit value.

Nice!, I think understand... well, I would put, for example, the number 1234567890 in a[0] = '1', a[1] = '2', a[3] = '3', and so on and the number 987654 in b[0] = '9', b[1] = '8', and so on.

After, I would convert each number in position to integer and I would operate separately. For example, convert a[n] and b[n] character number to integer number and operate; converting the result in character storing in tmp[i]. And son on to each position on the vector. Final tmp, is the number result after some operation. It`s correct?

You're off to a great start!

Can you think of anything that you haven't thought of?

Post back with any questions that you may have.

Suggested Topics

Topic Category Replies Views Activity
C and C++ 0 14 6d

Want to read more? Browse other topics in C and C++ or view latest topics.