-
Help with a Fibonacci
Hello,
I am very new to programming in C and wanted to try to create a program. However, when i try to run the program i get this message unable to read unknown load command 0x80000022.
Any help would be great
Code:
#include <stdio.h>
int main () {
int fib1;
int fib2;
int fib3;
int numfib;
printf("What number would you like to start with?");
scanf(fib1);
printf("What other number would you like to start with?");
scanf(fib2);
printf("How many numbers would you like printed?");
scanf(numfib);
printf("%d, %d", fib1, fib2);
for (numfib ;numfib>0 ; numfib--) {
fib3=fib1+fib2;
printf("%d", fib3);
fib1=fib3;
fib3=fib1+fib2;
printf ("%d", fib3);
fib2=fib3;
}
}
Thanks
-
scanf() tries to read input, and put it at the address you give it. You didn't give scanf() a valid address:
Code:
scanf("%d", &yourIntegerVariableNameHere);
-
Thanks that helped but now once my program runs it prints a bunch of numbers that have nothing to do with my code
-
I figured out my problem. Thank you for the help