Advertisement
silvana1303

array rotation / lists

Jun 2nd, 2020
82
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.Linq;
  3. using System.Collections.Generic;
  4. using System.Numerics;
  5. using System.Text;
  6.  
  7. namespace exampreparation
  8. {
  9.     class exam
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             List<int> numbers = Console.ReadLine().Split().Select(int.Parse).ToList();
  14.  
  15.             int times = int.Parse(Console.ReadLine());
  16.  
  17.             for (int i = 0; i < times; i++)
  18.             {
  19.                 int first = numbers[0];
  20.                 numbers.RemoveAt(0);
  21.                 numbers.Add(first);
  22.             }
  23.  
  24.             Console.WriteLine(string.Join(" ", numbers));
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement