Thread: how to print factorial of numbers upto 100

  1. #1
    Registered User
    Join Date
    Sep 2011
    Posts
    4

    how to print factorial of numbers upto 100

    i have not been able to calculate factorial of longer numbers as there is no data type available to store such big no.

    Plz tell me how to print factorial of big nos.

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    long long int ... range -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807

    on most compilers written in the past 8 to 10 years long long int is 64bits.

  3. #3
    Registered User
    Join Date
    Sep 2011
    Location
    Stockholm, Sweden
    Posts
    131
    For very large numbers you need bignum arithmetics, check out Arbitrary-precision arithmetic - Wikipedia, the free encyclopedia

  4. #4
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Quote Originally Posted by CommonTater View Post
    long long int ... range -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807

    on most compilers written in the past 8 to 10 years long long int is 64bits.
    And that is insufficient to represent 100! (which has a value of just under 1.0E158). That would need at least a 525-bit integral type.

    That is why some big integer representation (typically implemented as an array of unsigned or unsigned long, and a set of functions to operate on that representation) is needed.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Hi, Can anyone help me? print prime numbers.
    By kelai in forum C Programming
    Replies: 3
    Last Post: 09-29-2010, 01:35 PM
  2. Replies: 8
    Last Post: 08-15-2010, 05:59 PM
  3. to print prime nymbers upto 300
    By hum_tum2005007 in forum C Programming
    Replies: 2
    Last Post: 06-13-2008, 09:52 AM
  4. Need help to print even numbers
    By ortegac in forum C Programming
    Replies: 3
    Last Post: 05-21-2006, 12:01 AM
  5. How to print numbers?????
    By AssistMe in forum C Programming
    Replies: 2
    Last Post: 03-04-2005, 08:22 AM

Tags for this Thread