Coders Packet

Extra Long Factorials in C++

By Gaddam Shashikanth Reddy

  • extra_big_factorials.o
  • extra_big_factorials.exe
  • Extra_big_factorials.txt
  • extra_big_factorials.cpp
  • This is a C++ program to find the factorials of numbers that are too big to fit on any data type in C++.

    This is a C++ program to find the factorials of numbers that are too big to fit on any data type in C++.
    In python, there are datatypes to store huge numbers, but in C++, we cannot store a number having more
    than 18 digits using any datatype.
    So this method can be extended to other problems where the resulting numbers are significant.
    Factorials of some numbers
    23!
    25852016738884976640000
    56!
    710998587804863451854045647463724949736497978881168458687447040000000000000
    100! 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000
    As we can see, the numbers become huge within short intervals.

    Download Complete Code

    Comments

    No comments yet