forked from Anooppandikashala/youtube_c_tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray.c
More file actions
56 lines (51 loc) · 1.15 KB
/
array.c
File metadata and controls
56 lines (51 loc) · 1.15 KB
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
49
50
51
52
53
54
55
56
#include<stdio.h>
//to find the toper of the class
void main()
{
int mark[10]= {50, 60 ,89 ,68, 78, 59, 46 ,45 ,43, 58};
// printf("Enter the 10 marks :");
// for(int i=0;i<10;i++)
// {
// scanf("%d",&mark[i]);
// }
for(int i=0;i<10;i++)
{
printf("%d ",mark[i]);
}
// printf("Enter the Searching element :");
// int searchElement;
// scanf("%d",&searchElement);
// int isValuePresent=0;
// for(int i=0;i<10;i++)
// {
// if(mark[i] == searchElement)
// {
// isValuePresent = 1;
// printf("Search element found ");
// break;
// }
// }
// if(isValuePresent==0)
// {
// printf("Search element not found ");
// }
//sorting
for(int i=0;i<10;i++)
{
for(int j=0;j< 10-i-1;j++)
{
if(mark[j] > mark[j+1])
{
int temp = mark[j];
mark[j] = mark[j+1];
mark[j+1] = temp;
}
}
}
printf("\n ");
for(int i=0;i<10;i++)
{
printf("%d ",mark[i]);
}
printf("\nToper's mark : %d",mark[9]);
}