public class Fusion { public static void main(String[] args) { int t1[] = new int[10]; int t2[] = new int[10]; int t[] = new int[30]; for(int i=0;i<10;i++){ t1[i]= (int) (9*Math.random()+10);} for(int i=0;i<10;i++){ t2[i]= (int) (9*Math.random()+10);} System.out.print("Le premier tableau:"); System.out.print("\n"); for(int i=0;i<10;i++) System.out.print(" "+t1[i]+" "); System.out.print("\nLe deuxième tableau:"); System.out.print("\n"); for(int i=0;i<10;i++) System.out.print(" "+t2[i]+" "); for(int i=0;i<10;i++) t[i]=t1[i]; for(int i=0;i<10;i++) t[i+10]=t2[i]; System.out.print("\nLes deux tableaux fusionnés:"); System.out.print("\n"); for(int i=0;i<20;i++) System.out.print(" "+t[i]+" "); }}
- Tuesday
- December 24th, 2024
- Ajouter un cours