Deret Fibonacci dengan DEV C++
#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 a, b, c, d, e;
cout<<"Deret Fibonacci\n";
cout<<"Masukkan bilangan : ";cin>>a;
c=1;d=1;
cout<<c<<endl<<d<<endl;
for(int b=3; b<=a; b++)
{
e = c + d;
c = d;
d = e;
cout<<e<<endl;
}
return 0;
}
Deret Fibonacci dengan Pascal
Tidak ada komentar:
Posting Komentar