Advertisement
Teodor92

Odd Number

Dec 25th, 2012
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.70 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. class OddNumbers
  5. {
  6.     static void Main()
  7.     {
  8.         int n = int.Parse(Console.ReadLine());
  9.         Dictionary<long, int> allNumbers =
  10.         new Dictionary<long, int>();
  11.         for (int i = 0; i < n; i++)
  12.         {
  13.             long input = long.Parse(Console.ReadLine());
  14.             if (allNumbers.ContainsKey(input))
  15.             {
  16.                 allNumbers[input]++;
  17.             }
  18.             else
  19.             {
  20.                 allNumbers.Add(input, 1);
  21.             }
  22.         }
  23.         foreach (var item in allNumbers)
  24.         {
  25.             if (item.Value % 2 != 0)
  26.             {
  27.                 Console.WriteLine(item.Key);
  28.             }
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement