alexander masache

Hola soy de la carrera de informática

OTRA FORMA DE FIBONACCI POR RECURSIVIDAD

//DECLARACION DE LIBRERIAS
#include<iostream.h>
#include<conio.h>
#include<dos.h>

//Declaracion de prototipos
void  fun2(int n,int f,int aux );
void  main()
{
 clrscr();
 int a;
 cout<<”   > >>>*INGRESE LA CANTIDAD DE  NUMEROS …. \n”;
 cout<<”   >>>>* DE LA SERIE FIBONACCI QUE DESEE  …. \t”;
 cin>>a;
 cout<<”\n\n\n”;
 fun2(a,0,1);
 getch();
}

 

//LLAMAR UNA FUNCION DENTRO DENTRO DE OTRA FUNCION
void fun2(int n,int f,int aux)
{

 cout<<f<<”\n\n”;
 if(n>1)
 {
      fun2((n-1),(f+aux),(f));
 }

}

Todavía no hay comentarios »

Tu comentario

HTML-Tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>