Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace ITVillage
- {
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- public class Startup
- {
- public static void Main()
- {
- //1-vi variant
- Methods.Output();
- Console.WriteLine($"Max number is {Methods.GetMaxNumberFromConsoleInputs(int.Parse(Console.ReadLine()))}");
- //2-ri variant
- Methods.Output();
- Console.WriteLine($"Max number is {int.Parse(Console.ReadLine()).GetArrayFromConsoleInputs().Max()}");
- }
- }
- public static class Methods
- {
- public static readonly Action Output = () => Console.WriteLine("Vuvedi broq na chislata koito shte chetesh ot konzolata: ");
- public static readonly Func<int, int> GetMaxNumberFromConsoleInputs = input =>
- {
- int[] array = new int[input];
- for (int currSymbol = 0; currSymbol < input; currSymbol++)
- {
- array[currSymbol] = int.Parse(Console.ReadLine());
- }
- return array.Max();
- };
- public static int[] GetArrayFromConsoleInputs(this int number)
- {
- int[] array = new int[number];
- for (int currInput = 0; currInput < number; currInput++)
- {
- array[currInput] = int.Parse(Console.ReadLine());
- }
- return array;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement