# how to find unique integers and repeated integers

edited Aug 31, 2018
I wanted to know how should I Find out the unique integers and repeated integers. I have somehow found the repeated integers with their frequency. But how should I do the rest?

#include <stdio.h>

int main()
{

int c=0,arr[10],i,j,m=0;

printf("Enter 10 integers :");

for(i=0; i<10;i++)
{
scanf("%d",&arr[i]);
}

for(i=0; i<10; i++)
{
c=0;

for(j=0; j<10; j++)
{
if(arr[i]==arr[j])
{
c++;
}
}

if(c>1)
{
printf("\n%d was repeated %d times\n",arr[i],c);
}
}

return 0;

}

answered Sep 1, 2018 by diekleinekuh
#include <stdio.h>

int main()
{

int c=0,arr[10],i,j,m=0;

printf("Enter 10 integers :\n");

for(i=0; i<10;i++)
{
scanf("%d",&arr[i]);
}

for(i=0; i<10; i++)
{
c=1;

//add the number of times the value of arr[i] exists after i
for(j=i+1; j<10; j++)
{
if(arr[i]==arr[j])
{
c++;
}
}

//if the value of arr[i] exists before i it has been treated already
for (j=0; j<i; j++)
{
if(arr[i]==arr[j])
{
c=0;
}
}

if(c>1)
{
printf("\n%d was repeated %d times\n",arr[i],c);
}
else if (c==1)
{
printf("\n%d was unique\n");
}
}

return 0;
}