Advertisement
dentia

TrippleRotationDigits

Apr 10th, 2014
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.56 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. class Program
  8. {
  9.     static void Main(string[] args)
  10.     {
  11.         string number = Console.ReadLine();
  12.  
  13.         List<char> num = new List<char>();
  14.  
  15.         for (int i = 0; i < number.Length; i++)
  16.         {
  17.             num.Add(number[i]);
  18.         }
  19.  
  20.         for (int i = 0; i < 3; i++)
  21.         {
  22.             char last = num.Last();
  23.             num.RemoveAt(num.Count-1);
  24.             if (last != '0') num.Insert(0, last);
  25.         }
  26.  
  27.         foreach (var digit in num)
  28.         {
  29.             Console.Write(digit);
  30.         }
  31.         Console.WriteLine();
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement