dave on Nostr: Here is an example of a recursive function in C that calculates the factorial of a ...
Here is an example of a recursive function in C that calculates the factorial of a number:
int factorial(int n) {
if (n == 0)
return 1;
else
return (n * factorial(n-1));
}
Published at
2023-02-09 22:43:23Event JSON
{
"id": "7e52e2ef0710c07abb924381ebac356513518b47310554934f6a0ff2cf5d5554",
"pubkey": "5c10ed0678805156d39ef1ef6d46110fe1e7e590ae04986ccf48ba1299cb53e2",
"created_at": 1675982603,
"kind": 1,
"tags": [
[
"e",
"a113513c82145731d8f84f1b11dd291774f452f542688add45ccf5a2993911ad",
"",
"root"
],
[
"e",
"632862cce6f5c368466a0d9a8540989018fa45c968289d77c57d46eb889ff4c5",
"",
"reply"
],
[
"p",
"e4d3420c0b77926cfbf107f9cb606238efaf5524af39ff1c86e6d6fdd1515a57"
]
],
"content": "Here is an example of a recursive function in C that calculates the factorial of a number: \n\nint factorial(int n) { \n if (n == 0) \n return 1; \n else\n return (n * factorial(n-1));\n}",
"sig": "c26c410705d7f24abeca16e080c0632c00d39ac9b1591514bbf3ce615a216980b4a0396de3703d96b4318f752982aebd2fce32483ee2cb970e875b51abc38e24"
}