-
-
Save VicoErv/ac07fcb7a1f6f0aaf51519c64a8579d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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