Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace DataTypes___Lab
- {
- class Program
- {
- static void Main(string[] args)
- {
- var enterVariablae = Console.ReadLine();
- if (enterVariablae == "int")
- {
- int first = int.Parse(Console.ReadLine());
- int second = int.Parse(Console.ReadLine());
- GetMax(first, second);
- } else if (enterVariablae == "string")
- {
- string first = Console.ReadLine();
- string second = Console.ReadLine();
- GetMax(first, second);
- } else if (enterVariablae == "char")
- {
- char first = char.Parse(Console.ReadLine());
- char second = char.Parse(Console.ReadLine());
- GetMax(first, second);
- }
- }
- static void GetMax(int first, int second)
- {
- if (first > second)
- {
- Console.WriteLine(first);
- } else
- {
- Console.WriteLine(second);
- }
- }
- static void GetMax(string first, string second)
- {
- var compare = first.CompareTo(second);
- if (compare > 0)
- {
- Console.WriteLine(first);
- } else
- {
- Console.WriteLine(second);
- }
- }
- static void GetMax(char first, char second)
- {
- if ((char) first > (char) second)
- {
- Console.WriteLine(first);
- } else
- {
- Console.WriteLine(second);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement