ya_zay4eg

level07.lesson04.task05

Dec 7th, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.50 KB | None | 0 0
  1. package com.javarush.test.level07.lesson04.task05;
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.InputStreamReader;
  5.  
  6. /* Один большой массив и два маленьких
  7. 1. Создать массив на 20 чисел.
  8. 2. Ввести в него значения с клавиатуры.
  9. 3. Создать два массива на 10 чисел каждый.
  10. 4. Скопировать большой массив в два маленьких: половину чисел в первый маленький, вторую половину во второй маленький.
  11. 5. Вывести второй маленький массив на экран, каждое значение выводить с новой строки.
  12. */
  13.  
  14. public class Solution
  15. {
  16.     public static void main(String[] args) throws Exception
  17.     {
  18.         //Напишите тут ваш код
  19.         int bigInt[] = new int[20];
  20.         int smallIntOne[] = new int[10];
  21.         int smallIntTwo[] = new int[10];
  22.         BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
  23.         for (int i = 0; i <= 19; i++)
  24.         {
  25.             String bigIntString = reader.readLine();
  26.             bigInt[i] = Integer.parseInt(bigIntString);
  27.         }
  28.         for (int i = 0; i < 10; ++i)
  29.         {
  30.             smallIntOne[i] = bigInt[i];
  31.         }
  32.         for (int i = 10; i < bigInt.length; i++)
  33.         {
  34.             System.out.println(smallIntTwo[i-10]=bigInt[i]);
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment