mon code complet est:
merci pour vos aides.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 import java.util.Scanner; public class Test3 { public static void main(String[] args) { int tab[] = { 7, 4, 6, 8 }; System.out.println("Origine les éléments tableau est : 7,4,6,8"); for( int i=0; i<tab.length; i++ ) { int posmaxi=i; for( int j=i+1; j<tab.length; j++ ) { if( tab[j] < tab[posmaxi]) { posmaxi = j; } int temp = tab[posmaxi]; tab[i]=tab[posmaxi]; tab[posmaxi]= temp; } System.out.print( tab[i]+", "); } } }
Partager