Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace _02._InputList
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine(); //"1 2 3 4 5 6"
- List<int> numbers = input.Split(" ") // ["1", "2", "3", "4", "5", "6"]
- .Select(int.Parse) // [1, 2, 3, 4, 5, 6]
- .ToList(); // {1, 2, 3, 4, 5, 6}
- for (int index = 0; index <= numbers.Count - 1; index++)
- {
- Console.WriteLine("nums[" + index + "] = " + numbers[index]);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement