I'm doing this exercise where I need to show to the user a list of sequence from 1 to 1000 and I have to make:
- A1=1
- A2=(A1 +4)+(A1-2), which is 2*A1 + 2
But I'm having a few troubles here where it doesn't shows me the numbers being inserted in my list (array)... It only displays me a "0". What am I doing wrong here? Can't find it... Thanks.
#include <stdio.h>
#include <stdlib.h>
int main() {
int i;
float a;
float array[1000] = {1};
a = 1;
for (i = 0; i <= 1000; i++) {
array[i+1] = 2 * a + (a + 1);
printf("\nSequencia:%d - %.2f", i, array);
}
system("pause");
return 0;
}