I'm trying to calculate the Fibonacci series in my c program but when i try to output the result, i get 4 weird sequences of numbers which i dont know what they mean.Are they memory addresses or what? What am i doing wrong?
#include <stdio.h>
void fibonacci(int N) {
if(N == 0) {
printf("0\n");
} else if(N == 1) {
printf("0\n1\n");
} else { // calculate the fibonacci number
int temp;
int i;
for (i = 0; i <= N; i++) {
temp += i;
printf("%d \n",temp);
}
}
return;
}
int main() {
int n;
do {
printf("Please insert a Natural Number: \n");
scanf("%d",&n);
} while (n < 0);
fibonacci(n);
return 0;
}