Calculator
fac(12) =
479001600
🌐
Jakub Marian
jakubmarian.com › how-to-calculate-the-factorial-of-12
How to calculate the factorial of 1/2
I have just finished creating a Web App for people who enjoy learning by reading. Make sure to check it out; there's a lot of free content. As I proved in my article on integration by parts (at the end), the factorial of a natural number $n$ can be calculated using the following integral: $$ n!
🌐
ZeptoMath
zeptomath.com › calculators › factorial.php
12! - Factorial of 12
To determine the number of zeros at the end of a factorial, recursively divide the number by 5 until the quotient is less than 5, and sum the results after applying the greatest integer function. The greatest integer function (usually denoted by brackets) is the rounded down integer of a value. For example, [5] = 5, [4.5] = 4, [-4.5] = -5. For example, the number of trailing zeros in 12!
Top answer
1 of 3
3

Factorials get very large very fast - N! will overflow the native integer types for relatively low values of N.

To calculate any factorial larger than 20!, you will need to use a multi-precision library like GNU MP, like so:

#include <stdio.h>
#include <gmp.h>
#include <assert.h>

unsigned long fac( unsigned long n )
{
  unsigned long ret = 1;
  while( n )
    ret *= n--;
  return ret;
}

int main( void )
{
  for ( unsigned long i = 0; i < 21; i++ )
  {
    /**
     * Calculate factorial with native unsigned long type
     */
    printf( "fac(%2lu) = %21lu\t", i, fac(i) );
    
    /**
     * Calculate factorial using GMP - note that 99! has
     * 156 digits - that's equivalent to 519 bits. 
     * The largest native integer types currently max out
     * at 64 bits.  
     */
    mpz_t rop;
    mpz_fac_ui( rop, i );
    gmp_printf( "mpz_fac_ui(%2d) = %157Zd\n", i, rop );
  }

  printf( "------------ limit of unsigned long --------------\n" );

  for ( unsigned long i = 21; i < 100; i++ )
  {
    printf( "fac(%2lu) = %21lu\t", i, fac(i) );
    
    mpz_t rop;
    mpz_fac_ui( rop, i );
    gmp_printf( "mpz_fac_ui(%2d) = %157Zd\n", i, rop );
  }

  return 0;
}

Output of the program is:

fac( 0) =                     1 mpz_fac_ui( 0) =                                                                                                                                                             1
fac( 1) =                     1 mpz_fac_ui( 1) =                                                                                                                                                             1
fac( 2) =                     2 mpz_fac_ui( 2) =                                                                                                                                                             2
fac( 3) =                     6 mpz_fac_ui( 3) =                                                                                                                                                             6
fac( 4) =                    24 mpz_fac_ui( 4) =                                                                                                                                                            24
fac( 5) =                   120 mpz_fac_ui( 5) =                                                                                                                                                           120
fac( 6) =                   720 mpz_fac_ui( 6) =                                                                                                                                                           720
fac( 7) =                  5040 mpz_fac_ui( 7) =                                                                                                                                                          5040
fac( 8) =                 40320 mpz_fac_ui( 8) =                                                                                                                                                         40320
fac( 9) =                362880 mpz_fac_ui( 9) =                                                                                                                                                        362880
fac(10) =               3628800 mpz_fac_ui(10) =                                                                                                                                                       3628800
fac(11) =              39916800 mpz_fac_ui(11) =                                                                                                                                                      39916800
fac(12) =             479001600 mpz_fac_ui(12) =                                                                                                                                                     479001600
fac(13) =            6227020800 mpz_fac_ui(13) =                                                                                                                                                    6227020800
fac(14) =           87178291200 mpz_fac_ui(14) =                                                                                                                                                   87178291200
fac(15) =         1307674368000 mpz_fac_ui(15) =                                                                                                                                                 1307674368000
fac(16) =        20922789888000 mpz_fac_ui(16) =                                                                                                                                                20922789888000
fac(17) =       355687428096000 mpz_fac_ui(17) =                                                                                                                                               355687428096000
fac(18) =      6402373705728000 mpz_fac_ui(18) =                                                                                                                                              6402373705728000
fac(19) =    121645100408832000 mpz_fac_ui(19) =                                                                                                                                            121645100408832000
fac(20) =   2432902008176640000 mpz_fac_ui(20) =                                                                                                                                           2432902008176640000
------------ limit of unsigned long --------------
fac(21) =  14197454024290336768 mpz_fac_ui(21) =                                                                                                                                          51090942171709440000
fac(22) =  17196083355034583040 mpz_fac_ui(22) =                                                                                                                                        1124000727777607680000
fac(23) =   8128291617894825984 mpz_fac_ui(23) =                                                                                                                                       25852016738884976640000
fac(24) =  10611558092380307456 mpz_fac_ui(24) =                                                                                                                                      620448401733239439360000
fac(25) =   7034535277573963776 mpz_fac_ui(25) =                                                                                                                                    15511210043330985984000000
fac(26) =  16877220553537093632 mpz_fac_ui(26) =                                                                                                                                   403291461126605635584000000
fac(27) =  12963097176472289280 mpz_fac_ui(27) =                                                                                                                                 10888869450418352160768000000
fac(28) =  12478583540742619136 mpz_fac_ui(28) =                                                                                                                                304888344611713860501504000000
fac(29) =  11390785281054474240 mpz_fac_ui(29) =                                                                                                                               8841761993739701954543616000000
fac(30) =   9682165104862298112 mpz_fac_ui(30) =                                                                                                                             265252859812191058636308480000000
fac(31) =   4999213071378415616 mpz_fac_ui(31) =                                                                                                                            8222838654177922817725562880000000
fac(32) =  12400865694432886784 mpz_fac_ui(32) =                                                                                                                          263130836933693530167218012160000000
fac(33) =   3400198294675128320 mpz_fac_ui(33) =                                                                                                                         8683317618811886495518194401280000000
fac(34) =   4926277576697053184 mpz_fac_ui(34) =                                                                                                                       295232799039604140847618609643520000000
fac(35) =   6399018521010896896 mpz_fac_ui(35) =                                                                                                                     10333147966386144929666651337523200000000
fac(36) =   9003737871877668864 mpz_fac_ui(36) =                                                                                                                    371993326789901217467999448150835200000000
fac(37) =   1096907932701818880 mpz_fac_ui(37) =                                                                                                                  13763753091226345046315979581580902400000000
fac(38) =   4789013295250014208 mpz_fac_ui(38) =                                                                                                                 523022617466601111760007224100074291200000000
fac(39) =   2304077777655037952 mpz_fac_ui(39) =                                                                                                               20397882081197443358640281739902897356800000000
fac(40) =  18376134811363311616 mpz_fac_ui(40) =                                                                                                              815915283247897734345611269596115894272000000000
fac(41) =  15551764317513711616 mpz_fac_ui(41) =                                                                                                            33452526613163807108170062053440751665152000000000
fac(42) =   7538058755741581312 mpz_fac_ui(42) =                                                                                                          1405006117752879898543142606244511569936384000000000
fac(43) =  10541877243825618944 mpz_fac_ui(43) =                                                                                                         60415263063373835637355132068513997507264512000000000
fac(44) =   2673996885588443136 mpz_fac_ui(44) =                                                                                                       2658271574788448768043625811014615890319638528000000000
fac(45) =   9649395409222631424 mpz_fac_ui(45) =                                                                                                     119622220865480194561963161495657715064383733760000000000
fac(46) =   1150331055211806720 mpz_fac_ui(46) =                                                                                                    5502622159812088949850305428800254892961651752960000000000
fac(47) =  17172071447535812608 mpz_fac_ui(47) =                                                                                                  258623241511168180642964355153611979969197632389120000000000
fac(48) =  12602690238498734080 mpz_fac_ui(48) =                                                                                                12413915592536072670862289047373375038521486354677760000000000
fac(49) =   8789267254022766592 mpz_fac_ui(49) =                                                                                               608281864034267560872252163321295376887552831379210240000000000
fac(50) =  15188249005818642432 mpz_fac_ui(50) =                                                                                             30414093201713378043612608166064768844377641568960512000000000000
fac(51) =  18284192274659147776 mpz_fac_ui(51) =                                                                                           1551118753287382280224243016469303211063259720016986112000000000000
fac(52) =   9994050523088551936 mpz_fac_ui(52) =                                                                                          80658175170943878571660636856403766975289505440883277824000000000000
fac(53) =  13175843659825807360 mpz_fac_ui(53) =                                                                                        4274883284060025564298013753389399649690343788366813724672000000000000
fac(54) =  10519282829630636032 mpz_fac_ui(54) =                                                                                      230843697339241380472092742683027581083278564571807941132288000000000000
fac(55) =   6711489344688881664 mpz_fac_ui(55) =                                                                                    12696403353658275925965100847566516959580321051449436762275840000000000000
fac(56) =   6908521828386340864 mpz_fac_ui(56) =                                                                                   710998587804863451854045647463724949736497978881168458687447040000000000000
fac(57) =   6404118670120845312 mpz_fac_ui(57) =                                                                                 40526919504877216755680601905432322134980384796226602145184481280000000000000
fac(58) =   2504001392817995776 mpz_fac_ui(58) =                                                                               2350561331282878571829474910515074683828862318181142924420699914240000000000000
fac(59) =    162129586585337856 mpz_fac_ui(59) =                                                                             138683118545689835737939019720389406345902876772687432540821294940160000000000000
fac(60) =   9727775195120271360 mpz_fac_ui(60) =                                                                            8320987112741390144276341183223364380754172606361245952449277696409600000000000000
fac(61) =   3098476543630901248 mpz_fac_ui(61) =                                                                          507580213877224798800856812176625227226004528988036003099405939480985600000000000000
fac(62) =   7638104968020361216 mpz_fac_ui(62) =                                                                        31469973260387937525653122354950764088012280797258232192163168247821107200000000000000
fac(63) =   1585267068834414592 mpz_fac_ui(63) =                                                                      1982608315404440064116146708361898137544773690227268628106279599612729753600000000000000
fac(64) =   9223372036854775808 mpz_fac_ui(64) =                                                                    126886932185884164103433389335161480802865516174545192198801894375214704230400000000000000
fac(65) =   9223372036854775808 mpz_fac_ui(65) =                                                                   8247650592082470666723170306785496252186258551345437492922123134388955774976000000000000000
fac(66) =                     0 mpz_fac_ui(66) =                                                                 544344939077443064003729240247842752644293064388798874532860126869671081148416000000000000000
fac(67) =                     0 mpz_fac_ui(67) =                                                               36471110918188685288249859096605464427167635314049524593701628500267962436943872000000000000000
fac(68) =                     0 mpz_fac_ui(68) =                                                             2480035542436830599600990418569171581047399201355367672371710738018221445712183296000000000000000
fac(69) =                     0 mpz_fac_ui(69) =                                                           171122452428141311372468338881272839092270544893520369393648040923257279754140647424000000000000000
fac(70) =                     0 mpz_fac_ui(70) =                                                         11978571669969891796072783721689098736458938142546425857555362864628009582789845319680000000000000000
fac(71) =                     0 mpz_fac_ui(71) =                                                        850478588567862317521167644239926010288584608120796235886430763388588680378079017697280000000000000000
fac(72) =                     0 mpz_fac_ui(72) =                                                      61234458376886086861524070385274672740778091784697328983823014963978384987221689274204160000000000000000
fac(73) =                     0 mpz_fac_ui(73) =                                                    4470115461512684340891257138125051110076800700282905015819080092370422104067183317016903680000000000000000
fac(74) =                     0 mpz_fac_ui(74) =                                                  330788544151938641225953028221253782145683251820934971170611926835411235700971565459250872320000000000000000
fac(75) =                     0 mpz_fac_ui(75) =                                                24809140811395398091946477116594033660926243886570122837795894512655842677572867409443815424000000000000000000
fac(76) =                     0 mpz_fac_ui(76) =                                              1885494701666050254987932260861146558230394535379329335672487982961844043495537923117729972224000000000000000000
fac(77) =                     0 mpz_fac_ui(77) =                                            145183092028285869634070784086308284983740379224208358846781574688061991349156420080065207861248000000000000000000
fac(78) =                     0 mpz_fac_ui(78) =                                          11324281178206297831457521158732046228731749579488251990048962825668835325234200766245086213177344000000000000000000
fac(79) =                     0 mpz_fac_ui(79) =                                         894618213078297528685144171539831652069808216779571907213868063227837990693501860533361810841010176000000000000000000
fac(80) =                     0 mpz_fac_ui(80) =                                       71569457046263802294811533723186532165584657342365752577109445058227039255480148842668944867280814080000000000000000000
fac(81) =                     0 mpz_fac_ui(81) =                                     5797126020747367985879734231578109105412357244731625958745865049716390179693892056256184534249745940480000000000000000000
fac(82) =                     0 mpz_fac_ui(82) =                                   475364333701284174842138206989404946643813294067993328617160934076743994734899148613007131808479167119360000000000000000000
fac(83) =                     0 mpz_fac_ui(83) =                                 39455239697206586511897471180120610571436503407643446275224357528369751562996629334879591940103770870906880000000000000000000
fac(84) =                     0 mpz_fac_ui(84) =                               3314240134565353266999387579130131288000666286242049487118846032383059131291716864129885722968716753156177920000000000000000000
fac(85) =                     0 mpz_fac_ui(85) =                             281710411438055027694947944226061159480056634330574206405101912752560026159795933451040286452340924018275123200000000000000000000
fac(86) =                     0 mpz_fac_ui(86) =                           24227095383672732381765523203441259715284870552429381750838764496720162249742450276789464634901319465571660595200000000000000000000
fac(87) =                     0 mpz_fac_ui(87) =                         2107757298379527717213600518699389595229783738061356212322972511214654115727593174080683423236414793504734471782400000000000000000000
fac(88) =                     0 mpz_fac_ui(88) =                       185482642257398439114796845645546284380220968949399346684421580986889562184028199319100141244804501828416633516851200000000000000000000
fac(89) =                     0 mpz_fac_ui(89) =                     16507955160908461081216919262453619309839666236496541854913520707833171034378509739399912570787600662729080382999756800000000000000000000
fac(90) =                     0 mpz_fac_ui(90) =                   1485715964481761497309522733620825737885569961284688766942216863704985393094065876545992131370884059645617234469978112000000000000000000000
fac(91) =                     0 mpz_fac_ui(91) =                 135200152767840296255166568759495142147586866476906677791741734597153670771559994765685283954750449427751168336768008192000000000000000000000
fac(92) =                     0 mpz_fac_ui(92) =               12438414054641307255475324325873553077577991715875414356840239582938137710983519518443046123837041347353107486982656753664000000000000000000000
fac(93) =                     0 mpz_fac_ui(93) =             1156772507081641574759205162306240436214753229576413535186142281213246807121467315215203289516844845303838996289387078090752000000000000000000000
fac(94) =                     0 mpz_fac_ui(94) =           108736615665674308027365285256786601004186803580182872307497374434045199869417927630229109214583415458560865651202385340530688000000000000000000000
fac(95) =                     0 mpz_fac_ui(95) =         10329978488239059262599702099394727095397746340117372869212250571234293987594703124871765375385424468563282236864226607350415360000000000000000000000
fac(96) =                     0 mpz_fac_ui(96) =        991677934870949689209571401541893801158183648651267795444376054838492222809091499987689476037000748982075094738965754305639874560000000000000000000000
fac(97) =                     0 mpz_fac_ui(97) =      96192759682482119853328425949563698712343813919172976158104477319333745612481875498805879175589072651261284189679678167647067832320000000000000000000000
fac(98) =                     0 mpz_fac_ui(98) =    9426890448883247745626185743057242473809693764078951663494238777294707070023223798882976159207729119823605850588608460429412647567360000000000000000000000
fac(99) =                     0 mpz_fac_ui(99) =  933262154439441526816992388562667004907159682643816214685929638952175999932299156089414639761565182862536979208272237582511852109168640000000000000000000000


    
        
2 of 3
0

For some reason whenever I input a number above 12 it = 0.

The reason is the largest value a 32-bit signed integer can hold is 231-1 or 2,147,483,647. 13! is 6,227,020,800, so you have exceeded the bounds of a C int.

If your compiler supports it, unsigned long long will get you to 20!:

  • unsigned long long (64-bits) max is 264-1 or 18,446,744,073,709,551,615
  • 20! = 2,432,902,008,176,640,000 (ok)
  • 21! = 51,090,942,171,709,440,000 (too big)

You need a "big integer" library to handle integers bigger than this.

Or, use Python :

>>> import math
>>> format(math.factorial(100),',')
'93,326,215,443,944,152,681,699,238,856,266,700,490,715,968,264,381,621,468,592,963,895,217,599,993,229,915,608,941,463,976,156,518,286,253,697,920,827,223,758,251,185,210,916,864,000,000,000,000,000,000,000,000'
🌐
Filo
askfilo.com › cbse › smart solutions › what is the factorial of 12?
What is the factorial of 12?... | Filo
September 5, 2025 - The factorial of a positive integer n, denoted as n!, is the product of all positive integers from 1 to n. So, 12!
🌐
The Fraction Calculator
thefractioncalculator.com › Factorial › What-is-the-factorial-of-12.html
What is the factorial of 12? (12!) 12 Factorial
Here we will show you how to calculate the factorial of 12 (aka 12 factorial) and give you the exact answer. Before we begin, note that the factorial of 12 can be written as 12 followed by an exclamation mark like this: 12! Factorial of 12 means that you multiply 12 by every number below it.
🌐
CoolConversion
coolconversion.com › math › factorial › What-is-the-factorial-of_12_
What is the factorial of 12
The factorial symbol is the exclamation mark (!). If n is a natural number greater than or equal to 1, then · n! = n x (n - 1) x (n - 2) x (n - 3) ... 3 x 2 x 1 · If n = 0, then n! = 1, by convention. ... Trailing zeros are a sequence of zeros in the decimal representation of a number, after ...
🌐
Online Math School
onlinemschool.com › math › formula › factorial_table
Factorial table.
The best table of factorials and calculator which help you find the factorial of number
🌐
Wikipedia
en.wikipedia.org › wiki › Factorial
Factorial - Wikipedia
1 week ago - The "factors" that this name refers to are the terms of the product formula for the factorial. ... {\displaystyle n!=1\cdot 2\cdot 3\cdots (n-2)\cdot (n-1)\cdot n.} This may be written more concisely in product notation as ...
Find elsewhere
🌐
Math is Fun
mathsisfun.com › numbers › factorial.html
Factorial Function !
The factorial function (symbol: !) says to multiply all whole numbers from our chosen number down to 1. Examples:
🌐
Worksheet Genius
worksheetgenius.com › calc › factorials › factorial-of-12
What is the Factorial of 12? | Calculate 12!
There are many more complicated uses of factorials than this such as calculating binomials, astronomy, or advanced calculus but hopefully this helps you to understand it purely from a "how many different ways can the given items be arranged". When writing out a factorial as 12!, there are a couple of different ways to say it:
🌐
BrightChamps
brightchamps.com › home › math › math questions › factorial › factorial of 12
What is the Factorial of 12? | 12 Factorial [Solved]
October 8, 2025 - = 12 × 11 × 10 × 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1 = 479,001,600. Therefore, the factorial of 12 is 479,001,600.
🌐
CalculatorSoup
calculatorsoup.com › calculators › discretemathematics › factorials.php
Factorial Calculator n!
Factorial Calculator. Find the factorial n! of a number, including 0, up to 4 digits long. n! factorial calculator and examples. Free online factorial calculator.
🌐
Reddit
reddit.com › r/woosh › he just memorized what 12 factorial is, that’s all
r/woosh on Reddit: he just memorized what 12 factorial is, that’s all
August 27, 2022 - Onomatopoetic to the sound of an object moving past you at an accelerated pace. Post your favorite woosh! moments from Reddit here! ... 12! in math is a factorial which basically is: 12x11x10x9x8x7x6x5x4x3x2x1 = 479001600.
🌐
Mathondemand
mathondemand.com › home › solutions › factorial of 12 (12!)
Factorial of 12 (12!) - MathOnDemand.com
June 1, 2022 - Given: Number = 12 Formula: n! = n x (n -1) x (n -2) x . . . x 2 x 1 12! = 12 x 11 x 10 x 9 x 8 x 7 x 6 x 5 x 4 x 3 x 2 x 1 Factorial of 12: 12! = 479,001,600
🌐
Stat Trek
stattrek.com › online-calculator › factorial
Factorial Calculator
= (13)(12)(11)(10)(9)(8)(7)(6)(5)(4)(3)(2)(1) = 6,227,020,800 Note that the above calculation is a little cumbersome to compute by hand, but it can be easily computed using the Factorial Calculator. To use the Factorial Calculator, do the following: Enter "13" for n. Click the "Calculate" button.
🌐
Cuemath
cuemath.com › numbers › factorial
Factorial - Meaning, Formula | Factorial of Hundred & 0
Factorial of a positive number n is the product of that number with all the whole numbers that come before till 1. i.e., n factorial is calculated by the formula n! = n * (n - 1) * (n - 2) * ... * 3 * 2 * 1.
🌐
BYJUS
byjus.com › maths › factorial
Factorial
In Mathematics, factorial is a simple thing. Factorials are just products. An exclamation mark indicates the factorial. Factorial is a multiplication operation of natural numbers with all the natural numbers that are less than it.
Published   October 6, 2021
Views   1K
🌐
Quora
quora.com › How-many-perfect-squares-are-factors-of-12-factorial-12
How many perfect squares are factors of 12 factorial (12!)? - Quora
Answer (1 of 5): (EDITED) Take the prime powers: 12! = 2^10 × 3^5 × 5^2 × 7 × 11 Any selection from these roots with all even powers will be a perfect square and a factor of 12! We can ignore 7 and 11 as there are no positive even powers