Program Deret Fibonacci

#include <iostream.h>
#include <conio.h>

void deret_fibonanci(int);

main()
{ int n;
  cout<<"Banyaknya Deret : ";cin>>n;
  deret_fibonanci(n);
  getch(); }

void deret_fibonanci(int n)
{ int i,awal,akhir,deret;
  awal=1;akhir=1;
  cout<<"1  1  ";
  for (i=3;i<=n;i++)
  { deret=awal+akhir;
    awal=akhir;
    akhir=deret;
    cout<<akhir<<"  "; }}

Posted in: ,

0 komentar for "Program Deret Fibonacci"

Leave a reply