SHARE
TWEET

Problem 2. Метод Insert

desislava_topuzakova Jun 6th, 2020 737 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace AlgorithmsOverStructureData
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             string input = Console.ReadLine(); //2 3 4 5 6 7 1
  12.             List<int> startNumbers = input.Split(" ").Select(int.Parse).ToList();
  13.             int number = int.Parse(Console.ReadLine());
  14.             Console.WriteLine("Start array numbers: " + string.Join(", ", startNumbers));
  15.  
  16.             startNumbers.Add(number);
  17.             startNumbers.Sort();
  18.             List<int> sortedNumbers = startNumbers;
  19.             Console.WriteLine("End array numbers: " + string.Join(", ", sortedNumbers));
  20.  
  21.  
  22.  
  23.         }
  24.     }
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top