|
Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
|
Iterative implementation of Factorial More...
#include <cassert>#include <cstdint>#include <exception>#include <iostream>Namespaces | |
| namespace | math |
| for IO operations | |
Functions | |
| uint64_t | math::iterativeFactorial (uint8_t n) |
| Calculates the factorial iteratively. | |
| static void | test () |
| Self-test implementations to test iterativeFactorial function. | |
| int | main () |
| Main function. | |
Iterative implementation of Factorial
Calculates factorial iteratively.
\[n! = n\times(n-1)\times(n-2)\times(n-3)\times\ldots\times3\times2\times1 = n\times(n-1)!\]
for example: \(4! = 4\times3! = 4\times3\times2\times1 = 24\)
| int main | ( | void | ) |
|
static |
Self-test implementations to test iterativeFactorial function.