// Fichier Ex2.java public class Ex2 { static void afficherDiv(int nombre) { int rang = 0; System.out.printf("Les diviseurs de %d sont : \n", nombre); for(int candidat = 1 ; candidat <= nombre ; candidat++) if (nombre % candidat == 0) System.out.printf("%3d) %8d\n", ++rang, candidat); System.out.printf("\n"); } public static void main(String[] args) { final int NOMBRE1 = 6, NOMBRE2 = 20, NOMBRE3 = 17; Ex2.afficherDiv(NOMBRE1); Ex2.afficherDiv(NOMBRE2); Ex2.afficherDiv(NOMBRE3); } } /* 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. */