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 Count_real_numbers
- {
- class Program
- {
- static void Main(string[] args)
- {
- SortedDictionary<double, int> numbersCount = new SortedDictionary<double, int>();
- double[] numbers = Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
- for (int i = 0; i < numbers.Length; i++)
- {
- if (!numbersCount.ContainsKey(numbers[i]))
- {
- numbersCount.Add(numbers[i], 0);
- }
- numbersCount[numbers[i]]++;
- }
- foreach (KeyValuePair<double, int> number in numbersCount)
- {
- Console.WriteLine($"{number.Key} -> {number.Value}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement