fibonaci.cpp

Bookmark and Share
#include<iostream.h>

main ()

{int a,b,c,n,u=1;

cout<<"Masukkan bilangan pertama anda    : ";

cin>>a;

cout<<"Masukkan bilangan kedua anda      : ";

cin>>b;

cout<<"Banyaknya suku yang anda inginkan : ";

cin>>n;

while (u<=n)

{c=a+b;

cout<<a<<",";

u++;

a=b;

b=c;

}

return 0;

}



{ 0 komentar... Views All / Send Comment! }

Posting Komentar

Powered By Blogger