-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path20.c
47 lines (43 loc) · 845 Bytes
/
20.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
#include <stdio.h>
int main()
{
int x, k;
printf("Enter Array Size:");
scanf("%d", &x);
int arr[x];
int Count[x];
for (int i = 0; i < x; i++)
{
printf("Enter %d th Index;s Value:", i);
scanf("%d", &arr[i]);
Count[i] = -1;
}
for (int i = 0; i < x; i++)
{
k = 1;
for (int j = i + 1; j < x; j++)
{
if (arr[i] == arr[j])
{
k++;
Count[j] = 0;
}
else
{
k += 0;
}
}
if (Count[i] != 0)
{
Count[i] = k;
}
}
printf("Frequency Count\n");
for (int i = 0; i < x; i++)
{
if (Count[i] != 0)
{
printf("%d Occurs %d Times\n", arr[i], Count[i]);
}
}
}