Showing Repeated Values in Array

Showing Repeated Values in Array  using C++


C++ Program to show Repeated Values in Array


========================================================================



#include<iostream>
using namespace std;
main()
{
int arr[8]={10,20,20,30,30,50,60,70};
int i,j,repeat;

for(i=0;i<8;i++)
{
repeat=0;
for(j=7;j>=0;j--)
{
if(arr[i]==arr[j] && i!=j )
{
repeat=arr[j];
cout<<"Repeating Values in Array is "<<repeat<<endl;
}
}
     
}

}



========================================================================


OutPut :




Code  By : Farhat Abbas Jafri

SHARE
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment