Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace OddTimes
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Enter an array of numbers separated with space: ");
- int[] numbers = Console.ReadLine().Split(" ").Select(int.Parse).ToArray();
- int result = 0;
- for (int i = 0; i < numbers.Length; i++)
- {
- result = result ^ numbers[i];
- }
- Console.WriteLine("The number which occurs odd number of times is: ");
- Console.WriteLine(result);
- }
- }
- }
Add Comment
Please, Sign In to add comment