3 Java Interchange The Elements of An Array Description
3 Java Interchange The Elements of An Array Description
Priyadarshi Mrinal .
Write a Java program to interchange the elements of an array with the elements of another array without using the third array.If the array size differs display "Unable to
swap size differs".If the range is lesser or equal to Zero . Display "Invalid range "
Sample Input 1:
Enter the number of elements in the rst array :
3
Enter the elements in the rst array
1
2
3
Enter the number of elements in the second array :
3
Enter the elements in the second array
4
5
6
Sample Output 1:
The rst array after swapping is :
456
The second array after swapping is :
123
Sample Input 2:
-3
Sample Output 2:
Invalid range
Sample Input 3:
Sample Output 3:
User Notes
https://accenturelearning.tekstac.com/mod/vpl/view.php?id=992 1/2
11/12/2020 3 Java Interchange the elements of an array Description
Powered by Tekstac
https://accenturelearning.tekstac.com/mod/vpl/view.php?id=992 2/2