Advertisement
YavorGrancharov

Integer_Insertion

Jun 27th, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.63 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace Integer_Insertion
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             IList<int> list = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
  12.  
  13.             string input = Console.ReadLine();
  14.  
  15.             while (input != "end")
  16.             {
  17.                 int index = input[0] - 48;
  18.                 int item = int.Parse(input);
  19.  
  20.                 list.Insert(index, item);
  21.  
  22.                 input = Console.ReadLine();
  23.             }
  24.  
  25.             Console.WriteLine(string.Join(" ", list));
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement