1
0

Add number parse method

This commit is contained in:
Serghei Cebotari 2023-08-14 13:47:02 +03:00
parent 7ff9601f52
commit c8172ce7c0

View File

@ -4,20 +4,25 @@
{ {
public static void Main() public static void Main()
{ {
int count = int.Parse(Console.ReadLine()); int count = ParseNumber();
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
var numbers = ParseInput(); var numbers = ParseNumbers();
Console.WriteLine(numbers.Sum()); Console.WriteLine(numbers.Sum());
} }
} }
public static int[] ParseInput() public static int[] ParseNumbers()
{ {
return Console.ReadLine() return Console.ReadLine()
.Split(' ') .Split(' ')
.Select(x => int.Parse(x)) .Select(x => int.Parse(x))
.ToArray(); .ToArray();
} }
public static int ParseNumber()
{
return int.Parse(Console.ReadLine());
}
} }
} }