I tried to fill up an array with 'n' numbers, but i got stuck. So here is my code:
#include <iostream>
using namespace std;
int main(){
int n;
cin>>n;
int arr[n]={};
for (int i = 0;i <= n; i++) {
for(int k = 1; k <= n; k++) {
cout << arr[i] = k;
}
}
return 0;
}
So if u will input 3, it will output 1,2,3; In my code I tried to make a loop, that does the filling up array starting from 0 to n,and fill up with numbers from 1 to n. Help me pls!