sebenarny ane juga lupa kenapa bikin ini waktu Semester I kemarin, yaudahlah terserah...
#include <iostream>
using namespace std;
int main()
{
// _
// (_)
// __ _ _ __ __ _ __ _ _ __ _
// / _` | '_ \ / _` |/ _` | '__| |
// | (_| | | | | (_| | (_| | | | |
// \__,_|_|_|_|\__, |\__, |_| |_|
// | | | | __/ | __/ |
// | |_ _| | _|___/ |___/ __ _ _ __
// | | | | | |/ / '_ ` _ \ / _` | '_ \
// | | |_| | <| | | | | | (_| | | | |
// |_|\__,_|_|\_\_| |_| |_|\__,_|_| |_|
//
//
cout<<" PROGRAMED BY : ANGGRI LUKMAN DJATTA "<<endl;
int n;
int f_n;
int f_n1;
int f_n2;
cout << " program fibonacci \n";
cout << " masukan nilai n : ";
cin >> n;
f_n1 = 1;
f_n2 = 0;
cout << f_n1 << " ";
f_n + f_n1 + f_n2;
for(int i =1; i < n; i++){
f_n = f_n1 + f_n2;
f_n2 = f_n1;
f_n1 = f_n;
cout << f_n << " ";
}
cout<<endl<<endl;
cout << "akhir dari program ";
cin.get();
return 0;
}
Tidak ada komentar:
Posting Komentar