static void Main(string[] args) { int[] numbers = { 7, 1, 3, 6, 5 }; var searcher = new LinearSearch(); var index = searcher.Search(numbers, 1); System.Console.WriteLine(index); }
static void Main(string[] args) { Console.WriteLine("Enter input Array e.g. 1 2 3 4 5 6"); string[] input = Console.ReadLine().Split(" "); Console.WriteLine("Enter Search Value"); string searchInput = Console.ReadLine(); LinearSearch ls = new LinearSearch(); int result = ls.Search(input, searchInput); if (result > -1) { Console.WriteLine($"Found item at {result}"); } else { Console.WriteLine("Item not found item"); } }
static void Main(string[] args) { int[] numbers = { 10, 2, 34, 19, 38, 1, 28, 20 }; Console.WriteLine(LinearSearch.DoLinearSearch(numbers, 19)); Console.Read(); }