import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
System.out.println("Enter number of students: ");
int n=in.nextInt();
int [] scores=new int [n];
String [] names=new String [n];
for (int i=0;i<n;i++){
System.out.println("Enter name and score of student "+(i+1)+": ");
names[i]=in.next();
scores[i]=in.nextInt();
}
int min=scores[0];
String m_name="";
for(int i=0;i<n;i++){
if (scores[i]<min){
min=scores[i];
m_name=names[i];
}
}
System.out.println("The student with the lowest result has the following details:");
System.out.println("Name: "+m_name+"\nScore: "+min);
}
}
Comments
Leave a comment