Georgi_Kirov

Untitled

Jan 22nd, 2020 (edited)
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.94 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp331
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.  
  10.             string input = Console.ReadLine();
  11.             TestTheInputForInt(input);
  12.             TestTheInputForChar(input);
  13.             TestTheInputForString(input);
  14.  
  15.         }
  16.  
  17.  
  18.         private static void TestTheInputForInt(string input)
  19.         {
  20.             if (input == "int")
  21.             {
  22.                 int nomer1 = int.Parse(Console.ReadLine());
  23.                 int nomer2 = int.Parse(Console.ReadLine());
  24.  
  25.                 int min = Math.Min(nomer1, nomer2);
  26.                 int max = Math.Max(nomer1, nomer2);
  27.  
  28.                 Console.WriteLine(max);
  29.  
  30.             }
  31.  
  32.         }
  33.  
  34.  
  35.         private static void TestTheInputForChar(string input)
  36.         {
  37.             if (input == "char")
  38.             {
  39.                 char char1 = char.Parse(Console.ReadLine());
  40.                 char char2 = char.Parse(Console.ReadLine());
  41.  
  42.                 if (char1 > char2)
  43.                 {
  44.                     Console.WriteLine(char1);
  45.                 }
  46.                 else
  47.                 {
  48.                     Console.WriteLine(char2);
  49.                 }
  50.  
  51.             }
  52.  
  53.         }
  54.  
  55.  
  56.         private static void TestTheInputForString(string input)
  57.             {
  58.                 if (input == "string")
  59.                 {
  60.                     string purvoIme = Console.ReadLine();
  61.                     string vtoroIme = Console.ReadLine();
  62.  
  63.                     int duljinaNaString = purvoIme.Length;
  64.                     int duljinaNa2String = vtoroIme.Length;    
  65.  
  66.                     if (duljinaNaString > duljinaNa2String)
  67.                     {
  68.                         Console.WriteLine(purvoIme);
  69.                     }
  70.                     else
  71.                     {
  72.                         Console.WriteLine(vtoroIme);
  73.                     }
  74.  
  75.                 }
  76.             }
  77.  
  78.  
  79.        
  80.     }
  81. }
Add Comment
Please, Sign In to add comment