Skip to content

Instantly share code, notes, and snippets.

@hoctructuyencntt
Created July 26, 2022 02:29
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 hoctructuyencntt/09edaac473708eb55629376ae0607f8c to your computer and use it in GitHub Desktop.
Save hoctructuyencntt/09edaac473708eb55629376ae0607f8c to your computer and use it in GitHub Desktop.
#include<stdio.h>
long int Fact(int n);
int main() {
int n;
printf("Nhập một số nguyên dương: ");
scanf("%d",&n);
printf("Giai thừa %d = %ld", n, Fact(n));
return 0;
}
long int Fact(int n) {
if (n>=1)
return n*Fact(n-1);
else
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment