ellapt

TripleRotation

Dec 29th, 2012
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. using System;
  2. class TripleRotation
  3. {
  4. static void Main()
  5. {
  6. int rotN = int.Parse(Console.ReadLine());
  7. string n=Convert.ToString(rotN);
  8. int nl=n.Length;
  9. string outN="";
  10. for (int i = 0; i < 3; i++)
  11. {
  12. outN = n.Substring(nl - 1, 1);
  13. outN = outN + n.Substring(0, nl - 1);
  14. if (outN.Substring(0,1) == "0")
  15. {
  16. nl -= 1;
  17. outN = outN.Substring(1,nl);
  18. }
  19. n = outN;
  20. }
  21. Console.WriteLine(outN);
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment