alexander masache

Hola soy de la carrera de informática

Fibonacci la tercera forma

 

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

//Declaracion de prototipos
void  fun1(int n);

//VARIABLES GLOBALES
int b=1,c=1,f=0,fi=5,co=20;

//FUNCION PRINCIPAL
void  main()
{
 clrscr();
 int a;
 cout<<”   > >>>*INGRESE LA CANTIDAD DE  NUMEROS …. \n”;
 cout<<”   >>>>* DE LA SERIE FIBONACI QUE DESEE  …. \t”;
 cin>>a;
 cout<<”\n\n\n”;
 fun1(a);
 getch();
}

 

//LLAMAR UNA FUNCION DENTRO DENTRO DE OTRA FUNCION
void fun1(int n)
{
 gotoxy(co,fi);
 cout<<f<<”\n”;
 fi=fi+3;
 b=c;
 c=f;
 f=b+c;
 if(n>1)
 {
      n–;
      fun1(n);
 }

}

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>