Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Test
- {
- class Program
- {
- static Random rnd =new Random(); //генератор рандомныйх чисел
- static void Main(string[] args)
- {
- Console.WriteLine("Введите размерность массива");
- var n =int.Parse( Console.ReadLine());
- var mas = new int[n]; //создание массива
- for (int i = 0; i < mas.Length; i++)
- {
- mas[i] = rnd.Next(200, 500);
- Console.WriteLine(mas[i]);
- }
- var mas2=mas.ToList();
- mas2.Insert(0,5);//первый инд
- mas = mas2.ToArray();
- Console.WriteLine();
- foreach (int t in mas)
- {
- Console.WriteLine(t);
- }
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement