Advertisement
18126

Day3(ex4)

Jul 8th, 2021
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.22 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4.  
  5. int fact(int n) {
  6.     if(n == 0) {
  7.         return 1;
  8.     }
  9.     return fact(n-1) * n;
  10. }
  11.  
  12. int main() {
  13.     printf("%d\n", fact(5));
  14.     return EXIT_SUCCESS;
  15. }
  16.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement