public class Example6.1 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Enter the number of students ");
int n = input.nextInt();
int[] scores = new int[n];
System.out.println("Enter " + n +" scores: ");
int maxscore = 0;
for(int i=0; i<scores.length; i++){
scores[i] = input.nextInt();
if(scores[i]>maxscore)
maxscore = scores[i];
}
for(int u: scores)
System.out.print(u+"\t");
System.out.println();
for(int j=0; j<scores.length; j++){
if(scores[j]>=maxscore-10)
System.out.println("Student "+j+" score is "+scores[j]+" and grade is A");
else if(scores[j]>=maxscore-20)
System.out.println("Student "+j+" score is "+scores[j]+" and grade is B");
else if(scores[j]>=maxscore-30)
System.out.println("Student "+j+" score is "+scores[j]+" and grade is C");
else if(scores[j]>=maxscore-40)
System.out.println("Student "+j+" score is "+scores[j]+" and grade is D");
else
System.out.println("Student "+j+" score is "+scores[j]+" and grade is F");
}
}
}