Loading...
Loading...
Loading...
The exam cell keeps a student's marks. For a re-test, one subject's mark changes, but the original marks must stay on record. Copy the array, change the mark in the copy only, and print both.
Original: <marks> and Re-test: <marks>, marks separated by single spaces.Example
Input
3 72 85 90 2 95
Output
Original: 72 85 90 Re-test: 72 95 90
Subject 2 changes from 85 to 95 in the copy only.
Try the problem first. Open one hint at a time.
int[] retest = marks; would make the re-test change the original too.
marks.clone() gives a new array; change index k - 1 in it.
Write your Java code, run it on the examples and submit it to hidden tests.
Solve in the editor