I started working on a program generating an array, following a geometric progression with the number of elements, first element and ratio entered by the user. For some reason it's returning very... discouraging numbers.

Here's the code: 

```
#include <stdio.h>

void GenProg(float input[], int n, float first, float ratio, float *last){

for (int i = 1; i < n; i++){
    first = input[0];
    input[i] = input[i - 1] * ratio;
    }
*last = input[n - 1];
for (int i = 0; i < n; i++){
    printf("Element %i is: %f. \n", i + 1, input[i]);
  }
}

int main(){
float arr[25];
float a;
int n;
printf("Number of elements: ");
scanf("%i", &n);
printf("\n");
float first;
printf("First element: ");
scanf("%f", &first);
printf("\n");
printf("Ratio: ");
float ratio;
scanf("%f", &ratio);
GenProg(arr, n, first, ratio, &a);
printf("Last element: %f.\n", a);
}

```

Thanks.

For `n = 5; first = 1; ratio = 2`
I get:

```
`Element 1: -107374176.000000`
`Element 2: -214748352.000000`
`Element 3: -429496704.000000`
`Element 4: -858991408.000000`
`Element 5: -1717986816.000000`

```