aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerghei Cebotari <serghei@cebotari.ru>2023-08-14 13:47:02 +0300
committerSerghei Cebotari <serghei@cebotari.ru>2023-08-14 13:47:02 +0300
commitc8172ce7c02d50d231ac74a8bfb97e52f943f161 (patch)
tree380f738ab16a5932bbc5700b7e49e9f3078c97d3
parent7ff9601f528dc743e00ebc0486d1c7a67006a000 (diff)
Add number parse method
-rw-r--r--Codeforces.Console/Program.cs11
1 files changed, 8 insertions, 3 deletions
diff --git a/Codeforces.Console/Program.cs b/Codeforces.Console/Program.cs
index 49db58b..3fa975f 100644
--- a/Codeforces.Console/Program.cs
+++ b/Codeforces.Console/Program.cs
@@ -4,20 +4,25 @@
{
public static void Main()
{
- int count = int.Parse(Console.ReadLine());
+ int count = ParseNumber();
for (int i = 0; i < count; i++)
{
- var numbers = ParseInput();
+ var numbers = ParseNumbers();
Console.WriteLine(numbers.Sum());
}
}
- public static int[] ParseInput()
+ public static int[] ParseNumbers()
{
return Console.ReadLine()
.Split(' ')
.Select(x => int.Parse(x))
.ToArray();
}
+
+ public static int ParseNumber()
+ {
+ return int.Parse(Console.ReadLine());
+ }
}
} \ No newline at end of file