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