While i compile and run the code, there's negative value that not suppose to be appear.
Code:#include<conio.h> #include<stdio.h> int n=0; Fib(int n); void main() { clrscr(); int seriesSize = 35; int looper; printf("Print a Fibonacci series.\n"); for (looper=0;looper<seriesSize;looper++) { Fib(looper); printf("%d",Fib(looper)); printf("\n"); } getch(); } Fib(int n) { int x; if (n==0) x = 0; else if (n==1) x = 1; else x=Fib(int(n-1))+Fib(int(n-2)); return (x); }
Any idea?



LinkBack URL
About LinkBacks




.)