1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| import java.util.Scanner;
public class ex4
{
public static void main(String[] args)
{
float max;
float cote;
max=0;
String meilleur;
Scanner keyboard = new Scanner(System.in);
System.out.print("Quel est votre nombre d'etudiant ? : ");
int nbcote = keyboard.nextInt();
int cpt=1;
while (cpt<=nbcote)
{
System.out.print("Entrez le nom de l'eleve : ");
String x = keyboard.nextLine();
System.out.print(" Entrez maintenant sa cote : ");
cote = keyboard.nextInt();
if(cote>max)
{
max=cote;
String meilleur = x;
}
System.out.println(meilleur);
cpt=cpt+1;
}
}
} |