Like Tree1Likes
  • 1 Post By iceaway

how to print factorial of numbers upto 100

This is a discussion on how to print factorial of numbers upto 100 within the C Programming forums, part of the General Programming Boards category; i have not been able to calculate factorial of longer numbers as there is no data type available to store ...

  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
    Salem likes this.

  4. #4
    Registered User
    Join Date
    Jun 2005
    Posts
    6,646
    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, Sunshine, 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, 02:35 PM
  2. Replies: 8
    Last Post: 08-15-2010, 06:59 PM
  3. to print prime nymbers upto 300
    By hum_tum2005007 in forum C Programming
    Replies: 2
    Last Post: 06-13-2008, 10:52 AM
  4. Need help to print even numbers
    By ortegac in forum C Programming
    Replies: 3
    Last Post: 05-21-2006, 01: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


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21