Advertisement
sanec38

Test

Mar 30th, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.83 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Test
  8. {
  9.     class Program
  10.     {
  11.        
  12.       static Random rnd =new Random();   //генератор рандомныйх чисел
  13.         static void Main(string[] args)
  14.         {
  15.            
  16.             Console.WriteLine("Введите размерность массива");
  17.             var n =int.Parse( Console.ReadLine());
  18.            
  19.             var mas = new int[n];   //создание массива
  20.             for (int i = 0; i < mas.Length; i++)
  21.             {
  22.                 mas[i] = rnd.Next(200, 500);
  23.                 Console.WriteLine(mas[i]);
  24.             }
  25.             var mas2=mas.ToList();
  26.             mas2.Insert(0,5);//первый инд
  27.             mas = mas2.ToArray();
  28.             Console.WriteLine();
  29.             foreach (int t in mas)
  30.             {
  31.                 Console.WriteLine(t);
  32.             }
  33.            
  34.             Console.ReadLine();
  35.            
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement