Skip to content

Instantly share code, notes, and snippets.

@tomoliv30
Created July 11, 2022 12:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomoliv30/e7f5f61fe81a0addbffbbe3960dd9a1f to your computer and use it in GitHub Desktop.
Save tomoliv30/e7f5f61fe81a0addbffbbe3960dd9a1f to your computer and use it in GitHub Desktop.
void print_factorial(uint32_t num)
{
printf(“%u\n”, factorial(num, 1));
}
uint32_t factorial(uint32_t num, int res)
{
if (num >= 1)
return factorial(num - 1, res * num);
return res;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment