Advertisement
Infiniti_Inter

Практикум 5, задание 1, номер 11

Sep 16th, 2019
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.42 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 12 \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 public Input cin = new Input();
  43.  
  44.         static int f(int x) => x % 5 == 0 ? x / 5 : ++x;
  45.        
  46.  
  47.         static void Main(string[] args)
  48.         {
  49.             int x = cin.GetInt();
  50.             Console.WriteLine(f(x));
  51.         }
  52.  
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement