Advertisement
LegoDrifter

Rekurzija faktoriel..

Jan 31st, 2020
188
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. int faktoriel(int n)
  3. {
  4.     if(n==1)
  5.     {
  6.         return n;
  7.     }
  8.     else
  9.         return n*faktoriel(n-1);
  10. }
  11. void main()
  12. {
  13.     int n;
  14.     scanf("%d",&n);
  15.     printf("%d\n",faktoriel(n));
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement