11/12/2020 3 Java Interchange the elements of an array Description
Priyadarshi Mrinal .
Dashboard / Java / Arrays and Strings / Interchange the elements of an array
Description Code Editor Grading view
Interchange the elements of an array
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 "
Assume the maximum size of array is 20
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:
Enter the number of elements in the rst array :
-3
Sample Output 2:
Invalid range
Sample Input 3:
Enter the number of elements in the rst array :
Enter the elements in the rst array
Enter the number of elements in the second array :
Sample Output 3:
Unable to swap size differs
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
Add a note... Priyadarshi Mrinal .
Press Enter to save
Powered by Tekstac
https://accenturelearning.tekstac.com/mod/vpl/view.php?id=992 2/2