Loading...
Searching...
No Matches
Find the factorial of a given number. More...
#include <cassert>
#include <cstdint>
#include <iostream>
Go to the source code of this file.
namespace math for assertFind the factorial of a given number.
Calculate factorial via recursion
\[n! = n\times(n-1)\times(n-2)\times(n-3)\times\ldots\times3\times2\times1 = n\times(n-1)!\]
for example: \(5! = 5\times4! = 5\times4\times3\times2\times1 = 120\)
Definition in file factorial.cpp.
◆ main()Main function.
Definition at line 57 of file factorial.cpp.
57 {
59 return 0;
60}
static void tests()
Self-test implementations.
◆ tests()Self-test implementations.
Definition at line 44 of file factorial.cpp.
44 {
50 std::cout << "All tests have passed successfully!\n";
51}
uint64_t factorial(uint8_t n)
function to find factorial of given number
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4