Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Calculate factorial of a number using a recursive function.
#include <stdio.h> int factorial(int n) { if (n <= 1) return 1; return n * factorial(n - 1); } int main() { int n; scanf("%d", &n); printf("%d! = %d\n", n, factorial(n)); return 0; }
5
5! = 120