Skip to content

Instantly share code, notes, and snippets.

@VicoErv
Created December 20, 2019 11:14
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 VicoErv/ac07fcb7a1f6f0aaf51519c64a8579d2 to your computer and use it in GitHub Desktop.
Save VicoErv/ac07fcb7a1f6f0aaf51519c64a8579d2 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <conio.h>
long int faktorial(unsigned int n)
{
if (n == 0 || n == 1) {
return 1;
} else {
return n * faktorial(n - 1);
}
}
int main()
{
int n;
long int hasil;
printf("masukan nilai n = ");
scanf("%d", &n);
hasil = faktorial(n);
printf("Hasil %d ! = %ld ", n, hasil);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment