C Exercises: Find two numbers that occur odd number of times in an array
70. Two Numbers Occurring Odd Number of Times
Write a program in C to find two numbers that occur an odd number of times in an array.
Expected Output:
The given array is: 6 7 3 6 8 7 6 8 3 3
The two numbers occuring odd number of times are: 3 & 6
The problem requires writing a C program to identify two numbers in an array that each occur an odd number of times. The program should efficiently traverse the array, keeping track of the frequency of each element, and then determine and display the two numbers that meet the specified condition.
Visual Presentation:

Sample Solution:
C Code:
Output:
The given array is : 6 7 3 6 8 7 6 8 3 3 The two numbers occuring odd number of times are: 3 & 6
For more Practice: Solve these Related Problems:
- Write a C program to find the two numbers that occur an odd number of times using bitwise XOR operations.
- Write a C program to identify two odd-occurring elements by counting frequencies with a hash table.
- Write a C program to determine the two numbers using sorting and then scanning for odd frequencies.
- Write a C program to recursively find the two elements that appear an odd number of times in an array.
C Programming Code Editor:
Previous: Write a program in C to find out the maximum difference between any two elements such that larger element appears after the smaller number.
Next: Write a program in C to find the median of two sorted arrays of different size.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.