Вы находитесь на странице: 1из 1

Scanner sc=new Scanner(System.in); int valores, valores2, i,j; //**Cadena 01 do { System.out.print("Nmero de valores en la cinta1: "); valores = sc.

nextInt(); } while (valores <= 0); String[] val = new String[valores]; for (i = 0; i < val.length; i++) { System.out.print("Valor " + (i + 1) + ":"); val[i] = sc.next(); } //**Cadena 02 do { System.out.print("Nmero de valores en la cinta2: "); valores2 = sc.nextInt(); } while (valores2 <= 0); String[] val2 = new String[valores2]; //se crea el array // Entrada de datos. Se asigna a cada elemento del array // la nota introducida por teclado for (j = 0; j < val2.length; j++) { System.out.print("Valor " + (j + 1) + ":"); val2[j] = sc.next(); }

Вам также может понравиться