I created an array of ints, user is prompted to pick 2 numbers, I am trying to return the sequence of fibonacci from those 2 numbers
#include <stdio.h>
int main ()
{
int a, b;
int nums[48];
for (int i = 0; i < 47; i++)
{
printf ("Pick a number between 1 - 47\n");
scanf ("%d", &a);
printf ("Pick a number between 1 - 47\n");
scanf ("%d", &b);
if (a >= 47 || a <= 1)
{
printf ("Out of range pick another number between 1 - 47\n");
scanf ("%d", &a);
}
if (b >= 47 || b <= 1)
{
printf ("Out of range pick another number between 1 - 47\n");
scanf ("%d", &b);
}
nums[i] = a;
nums[i + 1] = b;
int c = a + b;
printf ("The sequence is: %d\n", c);
}
return 0;
}
Return up to 47 numbers of the fibonacci sequence