hi guys! plz help with the code in C which can calculate the fectorial of 500.

hi guys! plz help with the code in C which can calculate the fectorial of 500.

Could we see what you have so far.

>plz help with the code in C which can calculate the fectorial of 500.
The first thing you need to do is figure out how to do arbitrary precision arithmetic. 500! is a rather large number, after all:


Last I checked, that value exceeds the range of all the built-in types by a smidge or two.

This is a good library. Try inputting 500!
in their sample program and see what you get.

P.S : its factorial and not fectorial

It can be done using strings though. But I've not thought about it yet. The nature of this problem is similar to adding two 50 digit decimal numbers which has to done by strings

>It can be done using strings though.
Yes, it can. In fact, I'd say that's a starting point for the concept of an arbitrary length arithmetic library.

>But I've not thought about it yet.
The simplest way, at least conceptually, is to have strings of digits and then process them exactly as you would on paper using grade school arithmetic. It's not especially difficult, but for large numbers this naive solution can be very inefficient.

another feckless attempt to steal teh fectorial codez.