I wanted to find if the integers are unique or repeated and if repeated then how many times. I want to display the repeated integer only one time to show its frequency.
#include <stdio.h>
int main()
{
int c=0,arr[10],i,j,m=0,k;
printf("Enter 4 integers :");
for(i=0; i<4;i++)
{
scanf("%d",&arr[i]);
}
for(i=0; i<4; i++)
{
c=0;
for(j=0; j<4; j++)
{
if(arr[i]==arr[j])
{
c++;
}
}
for(k=0; k<4; k++)
{
if(c>1)
arr[k]=arr[i];
}
if(c>1)
{
printf("\n%d was repeated %d times\n",arr[k],c);
m=2;
}
}
if(m==0)
{
printf(" All are Unique integers");
}
return 0;
}