#include <conio.h>
#include <iostream.h>
#pragma argsused
int main()
{
int n0,n1,n2,i,bil;
cout<<"DERET BILANGAN FIBONACCI"<<endl;
cout<<"------------------------"<<endl;
cout<<endl;
cout<<"Masukkan batas bilangan : ";
cin>>bil;
cout<<endl;
cout<<"Deret Bilangan : ";
for(i=1;i<=bil;i++)
{
cout<<i<<" ";
}
cout<<endl;
cout<<"Deret Fibonacci : ";
n0=0;
n1=1;
for(i=1;i<=bil;i++)
{
n2=n0+n1;
cout<<n2<<" ";
n0=n1;
n1=n2;
}
getch();
}
0 comments:
Post a Comment