Get paid to share your links!

Bilangan Fibonacci

Wednesday, March 7, 2012

#include
#include
#include

void main()
{
unsigned int a[100], x, b, n, c;

cout<<"BILANGAN FIBONACCI\n"; cout<<"==================\n\n"; cout<<"------------------------------------------------------------------\n"; cout<<"ket:\n"; cout<<"\tBilangan fibonacci adalah deret bilangan yang menjumlahkan\n"; cout<<"dua buah bilangan sebelumnya untuk menentukan deret selanjutnya\n"; cout<<"\n"; cout<<"dengan rumus : a[n] = a[n-1] + [n-2]\n"; cout<<"------------------------------------------------------------------\n"; cout<<"\n"; cout<<"Deret bilangan ke berapa yang ingin anda ketahui : ke-";cin>>x;

c=x-1;

if (c>=2)
{
a[0]=1;
a[1]=1;

for (n=2; n<=c; n++)
{
a[n]=a[n-1]+a[n-2];
}
}
else if (c==1)
{
a[1]=1;
}
else
{
a[0]=1;
}

cout<<"\n";
cout<<"Bilangan Fibonacci pada deret ke-"< cout<<"\n";
cout<<"Hasil Deret :\n";
cout<<"^^^^^^^^^^^\n";

for (b=0; b<=c; b++)
{
a[0]=1;
a[1]=1;

for (n=2; n<=c; n++)
{
a[n]=a[n-1]+a[n-2];
}
cout< }
getch();
}
Share this article :

0 comments:

Speak up your mind

Tell us what you're thinking... !

Followers

 
Support : Creating Website | Johny Template | Mas Template
Copyright © 2011. Blog - All Rights Reserved
Template Created by Creating Website Inspired by Sportapolis Shape5.com
Proudly powered by Blogger