-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcount.c
More file actions
44 lines (43 loc) · 894 Bytes
/
Copy pathcount.c
File metadata and controls
44 lines (43 loc) · 894 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
44
//WAP to check the count of elements
//int 12342345
//output 1...1time
//2...2times
//3...2times
//4...2times
//5...1time
#include<stdio.h>
void main ()
{
int i,j,count=1,a[8];
printf("enter the elements\n");
for (i=0; i<8; i++)
{
scanf("%d",&a[i]);
}
for (i=0; i<8; i++)
{
for (j=i+1; j<8; j++)
{
if (a[i]>a[j])
{
int temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
for (i=0; i<8; i++)
{
printf("%d\t",a[i]);
}
for (i=0; i<8; i++)
{
if (a[i]==a[i+1])
count++;
else
{
printf("\n %d.......%d times",a[i],count);
count=1;
}
}
}