Skip to content

Instantly share code, notes, and snippets.

@viveknarang
Created October 3, 2017 20:17
Show Gist options
  • Save viveknarang/5d3dc8ae39be3e033d1b053648d2d42b to your computer and use it in GitHub Desktop.
Save viveknarang/5d3dc8ae39be3e033d1b053648d2d42b to your computer and use it in GitHub Desktop.
public class StudentScores {
public static void main (String [] args) {
final int SCORES_SIZE = 4;
int[] oldScores = new int[SCORES_SIZE];
int[] newScores = new int[SCORES_SIZE];
int i = 0;
oldScores[0] = 10;
oldScores[1] = 20;
oldScores[2] = 30;
oldScores[3] = 40;
for (i = 0; i < SCORES_SIZE; i++) {
newScores[i] = oldScores[(i+1)%SCORES_SIZE];
}
for (i = 0; i < SCORES_SIZE; ++i) {
System.out.print(newScores[i] + " ");
}
System.out.println();
return;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment