Ver Mensaje Individual
  #2 (permalink)  
Antiguo 19/12/2010, 13:31
vnvnation
 
Fecha de Ingreso: marzo-2009
Mensajes: 74
Antigüedad: 15 años, 1 mes
Puntos: 1
Respuesta: Error de código ... una ayuda plz

Yo entiendo la recursividad a si no se si este bien saludos men

Código C++:
Ver original
  1. #include<iostream.h>
  2. #include<conio.h>
  3.  
  4.  
  5. int fibo(int n)
  6. {
  7.    
  8.     if (n==1 || n==2)
  9.        return  1;
  10.     else
  11.         return  fibo(n-1) + fibo(n-2);
  12.                  
  13. }
  14.  
  15. int main()
  16. {
  17.     int v;
  18.    
  19.     cout<<"Ingrese numero: "<<endl;
  20.     cin>> v;
  21.     cout<<fibo(v)<<endl;
  22.     getche();  
  23.    
  24. }