Its the problem with my loop part. How do I fix this?
Code:
#include <stdio.h>
/* Define constant NUM_FIBON (number of fibonacci numbers) to be, say, 12 */
#define NUM_FIBON 12
int main()
{
/* Declare and initialise an int array with the first 2 fibonacci numbers 1 and 1 */
/* The size of the array should be NUM_FIBON. */
int fibonacci[NUM_FIBON] = {1, 1};
/* Display the purpose of the program */
printf("\nThis program displays the first %d fibonacci numbers\n", NUM_FIBON);
/* Populate the array with other fibonacci numbers, starting with the 3rd number */
/* Each fibonacci number is the sum of the previous two */
for (NUM_FIBON = 2; NUM_FIBON<=12; NUM_FIBON++)
{
fibonacci[NUM_FIBON] = fibonacci[NUM_FIBON-1] + fibonacci[NUM_FIBON-2];
}