-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUniqueEle.c
More file actions
43 lines (34 loc) · 865 Bytes
/
UniqueEle.c
File metadata and controls
43 lines (34 loc) · 865 Bytes
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
// Input the number of elements to be stored in the array: 4
// Input 4 elements in the array :
// element - 0 : 3
// element - 1 : 2
// element - 2 : 2
// element - 3 : 5
// Expected Output :
// The unique elements found in the array are:
// 3 5
#include<stdio.h>
int main () {
int a[100], n,i,j;
printf("Input the number of elements to be stored in the array : ");
scanf("%d", &n);
printf("Inputs %d element in the array:\n", n);
for (i = 0; i < n; i++)
{
printf("element - %d : ", i);
scanf("%d", &a[i]);
}
for (i = 0; i < n; i++)
{
for (j = i + 1; j < n; j++)
{
if (a[i] == a[j])
{
count++;
break;
}
}
}
printf("The unique elements found in the array are:%d\n",);
return 0;
}