Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication4
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Please enter a series of numbers seperated by a ,");
- string input = Console.ReadLine();
- string[] numbers = input.Split(',');
- Array.Sort(numbers);
- Console.WriteLine("Please enter number you would like to identify");
- int count1 = Convert.ToInt32(Console.ReadLine());
- //Console.WriteLine(Count<T>(count1));
- foreach (var item in numbers)
- {
- Console.WriteLine(item.ToString());
- }
- }
- static int Count< T > (T[] numbers, int value)
- {
- if (numbers == null || numbers.Length == 0)
- {
- return 0;
- }
- int count = 0;
- foreach (var item in numbers)
- {
- if (value.Equals(item))
- {
- count++;
- }
- }
- return count;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement