I am trying to solve a basic problem of finding people with over 5 years of experience. But the code is not running that way.
This is for running two user input command in the same for loop:
Scanner s = new Scanner(System.in);
int n = s.nextInt();
for (int i = 0; i <= n; i++) {
String name = s.nextLine();
System.out.println("enter experience");
int e = s.nextInt();
if (e > 5) {
} else {
}
}
The expected result is the number of people with over 5 years of experience but the actual is the code is asking for experience input only.