NedyalkoKikov

CountNumbers

Jun 2nd, 2016
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace SquareNumbers
  8. {
  9. class CountNumberts
  10. {
  11. static void Main()
  12. {
  13. List<int> nums = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
  14. int[] countNums = new int[1001];
  15. foreach(int n in nums)
  16. {
  17. countNums[n]++;
  18. }
  19. for (int i = 0; i < countNums.Length; i++)
  20. {
  21. if(countNums[i] > 0)
  22. {
  23. Console.WriteLine("{0} -> {1}",i,countNums[i]);
  24. }
  25. }
  26.  
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment