Advertisement
Sim0o0na

Untitled

Jun 11th, 2017
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.70 KB | None | 0 0
  1. using System;
  2. namespace _06_Problem_6.Catch_the_Thief
  3. {
  4.     class ProgramCatch_the_Thief
  5.     {
  6.         static void Main()
  7.         {
  8.           
  9.             string numeralType = Console.ReadLine();
  10.             int nums = int.Parse(Console.ReadLine());
  11.             long max = long.MinValue;
  12.             switch (numeralType)
  13.             {
  14.                 case "sbyte":
  15.                     try
  16.                     {
  17.                         
  18.                         for (int i = 0; i < nums; i++)
  19.                         {
  20.                             sbyte now = sbyte.Parse(Console.ReadLine());
  21.                             max = Math.Max(max, now);
  22.                         }
  23.  
  24.                     }
  25.                     catch (Exception)
  26.                     {
  27.  
  28.  
  29.                     }; break;
  30.                 case "int":
  31.  
  32.                     try
  33.                     {
  34.                         
  35.                         for (int i = 0; i < nums; i++)
  36.                         {
  37.                             int now = int.Parse(Console.ReadLine());
  38.                             max = Math.Max(max, now);
  39.                         }
  40.  
  41.                     }
  42.                     catch (Exception)
  43.                     {
  44.  
  45.  
  46.                     }; break;
  47.  
  48.                 case "long":
  49.  
  50.                     try
  51.                     {
  52.                          
  53.                         for (int i = 0; i < nums; i++)
  54.                         {
  55.                             long now = long.Parse(Console.ReadLine());
  56.                             max = Math.Max(max, now);
  57.                         }
  58.  
  59.                     }
  60.                     catch (Exception)
  61.                     {
  62.  
  63.  
  64.                     }; break;
  65.  
  66.             }
  67.  
  68.             Console.WriteLine(max);
  69.         }
  70.     }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement