Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp5
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine();
- if(input == "string")
- {
- string firstString = Console.ReadLine();
- string secondString = Console.ReadLine();
- string outputString = GetMax(firstString, secondString);
- Console.WriteLine(outputString);
- }
- else if (input == "int")
- {
- int firstNumber = int.Parse(Console.ReadLine());
- int secondNumber = int.Parse(Console.ReadLine());
- int outputInt = GetMax(firstNumber, secondNumber);
- Console.WriteLine(outputInt);
- }
- else
- {
- char firstChar = char.Parse(Console.ReadLine());
- char secondChar = char.Parse(Console.ReadLine());
- char outputChar = GetMax(firstChar, secondChar);
- Console.WriteLine(outputChar);
- }
- }
- public static string GetMax(string a,string b)
- {
- if(a.CompareTo(b) < 0)
- {
- return b;
- }
- else
- {
- return a;
- }
- }
- public static int GetMax(int a,int b)
- {
- int output = Math.Max(a, b);
- return output;
- }
- public static char GetMax(char a,char b)
- {
- int output = Math.Max((int)a, b);
- return (char)output;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment