#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;
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter