Explanation
In this program, we need to copy all the elements of one array into another. This can be accomplished by looping through the first array and store the elements of the first array into the second array at the corresponding position.
![](https://nerdutella.com/assets/dropzone/uploads/tinymce_images/questions/36388/mceu_36851230811667944254633.png)
Algorithm
- Declare and initialize an array.
- Declare another array of the same size as of first one
- Loop through the first array from 0 to length of the array and copy an element from the first array to the second array that is arr1[i] = arr2[i].
Input:
arr1 = [1, 2, 3, 4, 5];
arr2 = [None] * len(arr1);
Output:
Elements of original array: 1 2 3 4 5
Elements of new array: 1 2 3 4 5
Python
Output:
C
Output:
JAVA
Output:
C#
Output:
PHP
Output: