Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace GreaterOfTwoValues
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine().ToLower();
- switch (input)
- {
- case "int":
- int a = int.Parse(Console.ReadLine());
- int b = int.Parse(Console.ReadLine());
- Console.WriteLine(GetMax(a, b));
- break;
- case "char":
- char aa = char.Parse(Console.ReadLine());
- char bb = char.Parse(Console.ReadLine());
- Console.WriteLine(GetMax(aa, bb));
- break;
- case "string":
- string aaa = Console.ReadLine();
- string bbb = Console.ReadLine();
- Console.WriteLine(GetMax(aaa, bbb));
- break;
- }
- }
- static int GetMax(int a, int b)
- {
- if (a > b)
- {
- return a;
- }
- else
- {
- return b;
- }
- }
- static char GetMax(char aa, char bb)
- {
- if (aa > bb)
- {
- return aa;
- }
- else
- {
- return bb;
- }
- }
- static string GetMax(string aaa, string bbb)
- {
- int comparison = aaa.CompareTo(bbb);
- if (comparison > 0)
- {
- return aaa;
- }
- else
- {
- return bbb;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement