C++ Programming Code Examples C++ > Arrays and Matrices Code Examples C++ Program to Find Duplicate Elements in Array C++ Program to Find Duplicate Elements in Array Array is the collection of similar data type, In this program we find duplicate elements from an array, Suppose array have 3, 5, 6, 11, 5 and 7 elements, in this array 5 appear two times so this is our duplicate elements. #include<iostream.h> #include<conio.h> void main() { int x,arr[20],j,no; clrscr(); cout<<"Enter Size of array: "; cin>>no; cout<<"Enter any "<<no<<" num in array: "; for(x=0;x<no;x++) { cin>>arr[x]; } cout<<"Dublicate Values are: "; for(x=0; x<no; x++) { for(j=x+1;j<no;j++) { if(arr[x]==arr[j]) { cout<<"\n"<<arr[x]; } } } getch(); }