c program to count duplicates in an array

C
/**
 * C program to count total number of duplicate elements in an array
 */

#include <stdio.h>

#define MAX_SIZE 100  // Maximum array size

int main()
{
    int arr[MAX_SIZE];
    int i, j, size, count = 0;

    /* Input size of array */
    printf("Enter size of the array : ");
    scanf("%d", &size);

    /* Input elements in array */
    printf("Enter elements in array : ");
    for(i=0; i<size; i++)
    {
        scanf("%d", &arr[i]);
    }

    /*
     * Find all duplicate elements in array
     */
    for(i=0; i<size; i++)
    {
        for(j=i+1; j<size; j++)
        {
            /* If duplicate found then increment count by 1 */
            if(arr[i] == arr[j])
            {
                count++;
                break;
            }
        }
    }

    printf("\nTotal number of duplicate elements found in array = %d", count);

    return 0;
}#include <stdio.h>

int main(void) {
  int i,j,count=0;
  int a[10];
  int size;
  printf("enter the number of elements");
  scanf("%d",&size);
for(i=0;i<size;i++)
{
  printf("enter array elements");
  scanf("%d",&a[i]);
}
for(i=0;i<size;i++)
{
  for(j=i+1;j<size;j++)
  {
  if (a[i]==a[j])
  {
    count+=1;
    break;
  }
  }

}
printf("duplicate elements\n");
printf("%d",count);

  return 0;
}
Source

Also in C: