Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2014
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.57 KB | None | 0 0
  1. class MyClass {
  2.     static void Main() {
  3.         int[] array = InitArray();
  4.         PrintArray(array);
  5.     }
  6.  
  7.     public void PrintArray(int[] array) {
  8.         for (int i = 0; i < array.length; i++) {
  9.             Console.Write(array[i].toString());
  10.         }
  11.     }
  12.  
  13.     public int[] InitArray() {
  14.         Console.Write("Размер:");
  15.         int size = ReadIntLine();
  16.         int[] array = new int[size];
  17.  
  18.         Console.Write("Элементы: ");
  19.         for (int i = 0; i < array.length; i++) {
  20.             array[i] = ReadIntLine();
  21.         }
  22.         return array;
  23.     }
  24.  
  25.     public int ReadIntLine() {
  26.         return Convert.ToInt32(Console.ReadLine());
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement