Saturday, 15 October 2016

Program Deret Fibonacci

#include
#include
#include
int n;
char lagi;
int fibonacci(int n);
int main()
{
atas: Algoritma
cout<<"\n\nProgram Fibonacci "<cout<<"By Meldiya Reza"<cout<<"----------------------"<cout<<"\njumlah bilangan fibonacci : ";cin>>n;
for(int i=1;i<=n;i++)
cout<cout<printf("\nMau Menghitung Lagi [Y/T] : ");
scanf("%s",&lagi);
if (lagi=='Y'||lagi=='y')
goto atas;
else
goto bawah;


getch();
bawah:
clrscr();
printf("\n ---Makasih ^_^---\n");
cout<<"----------------------"<cout<
 int fibonacci(int n)
{
if(n==1)
return(0);
else if(n==2)
return(1);
else
return (fibonacci(n-1)+fibonacci(n-2));
}


0 comments:

Post a Comment