#include<stdio.h> #include<stdlib.h> int fibonacci(int x, int y,int z); int main() { int result2=0; int m,n,p; scanf("%d",&p); result2=fibonacci(m,n,p); system("pause"); } int fibonacci(int x, int y,int z) { int result=0; int count=1; x=0; y=1; printf(" %d ",y); for(count=1;count<=z-1;count++) { result=x+y; printf(" %d ",result); x=y; y=result; } return result; }
Tags : Fibonacci, function, function fibonacci
Tidak ada komentar:
Posting Komentar