This repository has been archived on 2025-12-15. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
2024-09-20 14:17:13 +03:00

18 lines
268 B
C

#include<stdio.h>
int fact(int n);
int main() {
int n;
printf("Enter a positive integer: ");
scanf("%d",&n);
printf("%d ! = %d \n", n, fact(n));
return 0;
}
int fact(int n) {
if (n>=1)
return n*fact(n-1);
else
return 1;
}