Friday, August 30, 2013
CONTOH PROGRAM MENGHITUNG DERET BILANGAN FINOBACHI
#include <stdio.h>
main(){
int nilai,i;
printf("Masukkan jumlah deret bilangan fibonacci : ");
scanf("%d",&nilai);
for(i=1;i<=nilai;i++){
printf("%d ",fibo(i));
}
return 0;
}
int fibo(int a){
if(a==0) return 0;
if (a == 1) return 1;
else return fibo(a-2) + fibo(a-1);
}
Author: Mohammad
Mohammad is the founder of STC Network which offers Web Services and Online Business Solutions to clients around the globe. Read More →
Related Posts:
Subscribe to:
Post Comments (Atom)














0 comments: