Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace SoftUniLists
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<int> list = ReadList();
- for(int i = 0; i < list.Count/2; i++)
- {
- Console.WriteLine(list[i] + list[list.Count-1-i]);
- }
- if (list.Count % 2 != 0)
- {
- Console.WriteLine(list[list.Count/2-1]);
- }
- }
- static List<int> ReadList(int n)
- {
- var list = new List<int>();
- for (int i = 0; i < n; i++)
- {
- list.Add(int.Parse(Console.ReadLine()));
- }
- return list;
- }
- static List<int> ReadList()
- {
- List<int> list = new List<int>();
- var line = Console.ReadLine();
- list = line.Split().Select(int.Parse).ToList();
- return list;
- }
- static void PrintList(List<int> list)
- {
- for (int i = 0; i < list.Count; i++)
- {
- Console.WriteLine(list[i]);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment