#include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
int suku, a,b,c;
cout<<"\t\t*************************************"<<endl;
cout<<"\t\t program menampilkan deret febonacci "<<endl;
cout<<"\t\t*************************************"<<endl<<endl;
cout<<"masukan nilai ke- : ";cin>>suku;
cout<<"bilangannya adalah : ";
a=0;
b=1;
cout<<a<<endl<<b<<endl;
for(int i=3; i<=suku; i++)
{
c=a+b;
a=b;
b=c;
cout<<c<<endl;
}
return 0;
}
Tidak ada komentar:
Posting Komentar