psotirov

Triple Rotation of Digits

Dec 29th, 2012
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.47 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. class TrippleDigits
  7. {
  8.     static void Main()
  9.     {
  10.         string N = Console.ReadLine();
  11.         for (int i = 0; i < 3; i++)
  12.         {
  13.             char last = N[N.Length - 1];
  14.             N = N.Substring(0, N.Length -1);
  15.             if (last != '0')
  16.             {
  17.                 N = last + N;
  18.             }            
  19.         }
  20.         Console.WriteLine(N);
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment