MCPcopy Create free account
hub / github.com/RobTillaart/Arduino / factorial

Function factorial

libraries/statHelpers/statHelpers.cpp:128–133  ·  view source on GitHub ↗

exact ==> 12!

Source from the content-addressed store, hash-verified

126
127// exact ==> 12!
128uint32_t factorial(uint8_t n)
129{
130 uint32_t f = 1;
131 while(n > 1) f *= (n--);
132 return f;
133}
134
135
136// exact ==> 20!

Callers 1

unittestFunction · 0.85

Calls

no outgoing calls

Tested by 1

unittestFunction · 0.68