// Fichier Ex1.java public class Ex1 { public static void main(String[] args) { final int NOMBRE1 = 6, NOMBRE2 = 20, NOMBRE3 = 17; int rang; // afficher les diviseurs de 6 : rang = 0; System.out.printf("Les diviseurs de %d sont : \n", NOMBRE1); for(int candidat = 1 ; candidat <= NOMBRE1 ; candidat++) if (NOMBRE1 % candidat == 0) { rang++; System.out.printf("%3d) %8d\n", rang, candidat); } System.out.printf("\n"); // afficher les diviseurs de 20 : rang = 0; System.out.printf("Les diviseurs de %d sont : \n", NOMBRE2); for(int candidat = 1 ; candidat <= NOMBRE2 ; candidat++) if (NOMBRE2 % candidat == 0) { rang++; System.out.printf("%3d) %8d\n", rang, candidat); } System.out.printf("\n"); // afficher les diviseurs de 17 rang = 0; System.out.printf("Les diviseurs de %d sont : \n", NOMBRE3); for(int candidat = 1 ; candidat <= NOMBRE3 ; candidat++) if (NOMBRE3 % candidat == 0) { rang++; System.out.printf("%3d) %8d\n", rang, candidat); } System.out.printf("\n"); } } /* Exécution : --------------------Configuration: -------------------- Les diviseurs de 6 sont : 1) 1 2) 2 3) 3 4) 6 Les diviseurs de 20 sont : 1) 1 2) 2 3) 4 4) 5 5) 10 6) 20 Les diviseurs de 17 sont : 1) 1 2) 17 Process completed. */