Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. int fact(int n){
  2. if(n==1){
  3. return 1;
  4. }else{
  5. return (n*fact(n-1));
  6. }
  7. }
  8.  
  9. int main(void){
  10. printf("%i n",fact(13));
  11. }
  12.  
  13. function fact(n){
  14. if (n==1){
  15. return (1);
  16. }else{
  17. return (n*fact(n-1));
  18. }
  19. }
  20.  
  21. console.log(fact(13));
  22.  
  23. def fact(n):
  24. if(n == 0):
  25. return 1
  26. else:
  27. return n * fact(n - 1)
  28.  
  29. print(fact(13))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement