1 classe publique test2 { 2 public static void main (String [] args) { 3 int a = 10 ; 4 int b = 20 ; 5 int c = 30 ; 6 int max = (a> b)? (a> c? a: c): (b> c? b: c); 7 int min = (a <b)? (a <c? a: c): (b <c? b: c); 8 System.out.println ("max =" + max); 9 System.out.println ("min =" + min); 10 } 11 }
Trouvez le maximum et le minimum de trois nombres
int max = (a> b)? un B;
max = (max> c)? max: c;
int min = (a <b)? un B;
min = (min <c)? min: c;