Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace AlgorithmsOverStructureData
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine(); //"2 3 4 5 6 7"
- int[] numbers = input.Split(" ").Select(int.Parse).ToArray();
- //["2", "3", ...] -> [2, 3, 4, 5, 6, 7]
- int number = int.Parse(Console.ReadLine());
- foreach(int numberInArray in numbers)
- {
- if (numberInArray == number)
- {
- Console.WriteLine($"{number} Exists in the List");
- return;
- }
- }
- Console.WriteLine($"{number} Not exists in the List");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement