Here's the question I've been given:
Create a 4X3 integer array and fill it, column by column using loops, with the odd numbers starting with 1. In a separate, one dimensional array, store the average of each column of the 4X3 array. Output the 4X3 array (as a 4X3 array) and output the average of each column underneath each column. Label these as the average.
I just learned that I can make an array like this: N[4][3]
, but should I even do that here? I feel like setting up an array for each range: 1-4, 5-8 & 9-12, would work better so I can average them at the end.
I'm unfamiliar with multidimensional arrays, so please let me know if this is where I should start (I realize this isn't my idea, where I split them up that I mentioned earlier. I'm still unsure about this, in case you can't tell).
int X, N[3][4]={1};
for(X=1; X<12; X++) {
N[X]= N[X-1]+2;
}
As far as I know, the tables are auto-filled, where each row is filled in order, rather than each column. How do I fill them in columns? I think that the splitting-them-up strategy would do this for me, correct me if I'm wrong.