Problema 2

PHOTO EMBED

Thu Dec 02 2021 19:17:51 GMT+0000 (Coordinated Universal Time)

Saved by @DViorel

#include <iostream>

using namespace  std;

void constrVect (int v[], int &n){
    int nrPare = n * 2 - 2, l = 0;
    for (int i = nrPare; i >= 0;  i = i - 2)
        v[++ l] = i;
}

int main() {
    int v[100], n;
    cin >> n;

    constrVect(v, n);
    for (int i = 1; i <= n; i ++)
        cout << v[i] << " ";
    return 0;
}
content_copyCOPY