1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| import java.util.Scanner;
public class ExamenMinMaxMoyenne {
public static Scanner scanner = new Scanner(System.in);
public static void main(String[] args) {
int max = 0, min = 0, moyenne = 0;
for (int i=1; i<=5; i++){
System.out.println("la cote numero" + i);
int cote = scanner.nextInt();
if (cote>max){
max = min;
max = cote;
}else{
if (cote<min){
min=cote;
}
}
}
System.out.println("la cote plus eleve est "+ max + ", " +"la cote la plus basses est "+ min);
}
} |