Write a program to copy a 1-dimension array with 12 elements into a 2-dimensional array with 3x4 elements. Print the 2-D array as a matrix.
If someone has already given an answer for above problem, try other combinations like a 1-dimension array with 8 elements into a 2-dimensional array with 2x4 elements.
- You can directly initialize a 1-D array and then use a for loop to copy. 1-D array has only one index as arr1[i] and 2-D array has two indexes as arr2[j][k].
- To print the 2-D array as a matrix, use two for loops. Outside loop is for rows and inner one for col. Inner one will be executed for all rows.
ALL THE BEST!!!