Find lowest consecutive value
Avoid globals. consecutivo is particularly confusing. It is too easy to miss the fact that it is reset to 0 at each iteration. Always prefer returning a value:
int suma_elementos(int elemento)
{
    int proporcion = n;
    int consecutivo = 0;
    while (proporcion &gt;= elemento)
    {
        proporcion--;
        consecutivo++;
    }
    return consecutivo;
}

and use it in your loop as
    int consecutivo = suma_elementos(consecutivos[i]);


Now it is obvious that suma_elementos does not really need to loop. You have an invariant proporcion + consecutivo == n. At the end of the last iteration you also have proporcion == elemento, which means that consecutivo = n - elemento. In other words,
int suma_elementos(int elemento)
{
    return n - elemento;
}


Now I would rather not bother to have suma_elementos at all (besides, with my poor Spanish I have an impression that the name is rather misleading). The loop would become
    for (int j = 0; j &lt; n - consecutivos[i]; j++)

Honestly, it is much easier to understand.

final = 99999999; is very fragile. Consider a ramp-up loop:
  final = 0;
  for (int j = 0; j &lt; consecutivos[i]; j++) {
      total += elementos[j];
  }


Your code complexity is \$O(n*k)\$ (k being a width of the window). Notice that after the ramp-up you don't need to recompute the sums of k elements: as the window shifts, one element enters, another leaves:
  final = total;
  for (int leave = 0, enter = base[i]; enter &lt; n; leave++, enter++) {
      total += elementos[enter] - elementos[leave];
      if (total &lt; final) {
          final = total;
      }
  }

obtaining \$O(n + k)\$ complexity.