
{filelink=13}
/***** Code de MesExemples.com *******/
class Nombres {
public static void main(String[] args) {
//créer un tableau de 10 nombres
int nombres[] = new int[]{14,25,-85,10,22,859,-963,20,255,-1};
int plusPetit = nombres[0];
int plusGrand = nombres[0];
for(int i=1; i plusGrand)
plusGrand = nombres[i];
else if (nombres[i] < plusPetit)
plusPetit = nombres[i];
}
System.out.println("Le plus grand nombre est : " + plusGrand);
System.out.println("Le plus petit nombre est : " + plusPetit);
}
}
/*
Le plus grand nombre est : 859
Le plus petit nombre est : -963
*/