-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path14C01.c
48 lines (43 loc) · 881 Bytes
/
14C01.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include<stdio.h>
void main()
{
int size;
int i;
int j;
int count=0;
int c;
printf("Enter size of array : ");
scanf("%d",&size);
int a[size];
int f[size];
for ( i = 0; i < size; i++)
{
printf("Enter elements of array: ");
scanf("%d",&a[i]);
f[i]= -1;
}
for ( i = 0; i < size; i++)
{
c=1;
if (f[i]!=0)
{
for ( j = i+1; j < size; j++)
{
if (a[i]==a[j])
{
c++;
f[j]=0;
}
}
}
if (c>1)
{
count=count+1;
f[i]=c;
}
}
if (count>0)
{
printf("Total duplicate element is %d\n",count);
}
}