Advertisement
Infiniti_Inter

Практикум 2, задание 3, номер 11

Sep 9th, 2019
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.72 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. namespace mainSolution
  8. {
  9.     public class MyException : Exception
  10.     {
  11.         public MyException(string messege) : base(message: messege + "\n\n\n Exception founded by Decibit\n\n\n") { }
  12.         public MyException() : base()
  13.         {
  14.  
  15.         }
  16.         public void Messsage()
  17.         {
  18.             Console.WriteLine("\n\n\n\n\n\n Invalid number, please enter a number from 1 to 10 \n\n\n\n\n\n");
  19.         }
  20.  
  21.  
  22.     }
  23.     class Input
  24.     {
  25.         private static IEnumerator<string> getin()
  26.         {
  27.             while (true)
  28.                 foreach (string s in Console.ReadLine().Split().Where(x => x.Length > 0))
  29.                     yield return s;
  30.         }
  31.  
  32.         private IEnumerator<string> inp = getin();
  33.  
  34.         public string GetString() { inp.MoveNext(); return inp.Current; }
  35.         public int GetInt() { return int.Parse(GetString()); }
  36.         public long GetLong() { return long.Parse(GetString()); }
  37.         public double GetDouble() { return double.Parse(GetString()); }
  38.     }
  39.  
  40.     static class Program
  41.     {
  42.         static StringBuilder solve(StringBuilder number)
  43.         {
  44.             char temp = number[0];
  45.             number[0] = number[number.Length - 1];
  46.             number[number.Length - 1] = temp;
  47.             temp = number[1];
  48.             number[1] = number[2];
  49.             number[2] = temp;
  50.             return number;
  51.  
  52.         }
  53.         static void Main(string[] args)
  54.         {
  55.  
  56.             Input cin = new Input();
  57.             StringBuilder number = new StringBuilder(cin.GetString());
  58.             Console.WriteLine(solve(number));
  59.         }
  60.     }
  61.  
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement