Syintax C++:
//NAMA : NURMALITA SAFITRI
//NIM : 1400018163
//SYNTAX C++ :
#include <iostream>
#include <string>
using namespace std;
void Fibonacci (int n,int a,int b,int c)
{
if (n>0)
{
cout << c << endl;
c =a+b;
a =b;
b =c;
Fibonacci(n-1,a,b,c);
}
else
{
}
}
int main()
{
string raptor_prompt_variable_zzyz;
int n,a,b,c;
a =0;
b =1;
c =1;
cout<<"masukan banyak suku=";
cin >> n;
cout << a << endl;
Fibonacci(n,a,b,c);
return 0;
}
Outputnya :
RAPTOR :
Outputnya :
Tidak ada komentar:
Posting Komentar