/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
public class Main {
public static void main(String[] args) {
System.out.println("Tableau 1");
int[] tab = {15, 11, 10, 14, 18, 5};
// Utilisation de la boucle for pour afficher les éléments du tableau
System.out.print("Utilisation de la boucle for : ");
for (int i = 0; i < 6; i++) {
System.out.print(" " + tab[i] + " ");
}
System.out.println(); // Nouvelle ligne pour formater la sortie
// Utilisation de la boucle for-each pour afficher les éléments du tableau
System.out.print("Utilisation de la boucle for-each : ");
for (int element : tab) {
System.out.print(" " + element + " ");
}
System.out.println(); // Nouvelle ligne pour formater la sortie
}
}