Advertisement
Jorge_Lugo97

T6

Nov 17th, 2019
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.30 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(){
  5.     int n;
  6.         printf("El valor de n: ");
  7.         scanf("\n %d",&n);
  8.         printf("El nuevo valor es: ");
  9.         printf("\n %d", rec3(n));
  10.         return 0;
  11. }
  12.  
  13. int rec3 (int n){
  14.     if (n<=1)
  15.         return (1);
  16.        
  17.         else if (n>1)
  18.         return (rec3 (n-1) + rec3 (n-1));
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement