Help- super stumped on my loop...

I need to create a loop so the amount that you input for example 5 students inputted, will corrospond to a grade. I have done the code, I just don't understand how I can get the input to corrospond to the grades. Here is what I have so far:

public class practise {

  public static void main(String[] args) {
Scanner in = new Scanner (System.in);
int i = 0;
int sum = 0;

System.out.println("Enter the number of students: ");
int students = in.nextInt();

System.out.println("Enter exam score of each student:");
int score = in.nextInt();

for (; students < score; students++) {
int n = in.nextInt();
sum+=n;

if (n >= 41) {
System.out.println("Invalid exam scores, reenter: ");
}
}
if (score <= 40 && score >= 36 ) {

} if (score <= 35 && score >= 30) {

} if (score <= 29 && score >= 20) {

} if (score <= 19 && score >= 0 ) {

}
}
}

What is it that I need to do to get this to work?

## All 3 Replies

I have thought about it, I will need to assign each student entered a number in the loop

so student 1 (0) student 2 (1) student 3 (2) ext. That much I understand but then how can I get this to corrospond to the grade?

Your code is almost almost there...
Here's a simple way to structure it (pseudo code)

ask for number of students
for n = 1 to number of students {
ask for student n's score
} 
so all you need to do is fix your for statement and move entering the score to inside the loop. Fixing your indentation will be an enormous help in seeing what's happening!