The Eduladder is a community of students, teachers, and programmers just interested to make you pass any exams. So we help you to solve your academic and programming questions fast.
Watch related videos of your favorite subject.
Connect with students from different parts of the world.
See Our team
Wondering how we keep quality?
Got unsolved questions?

UNIX-SYSTEMS-PROGRAMMING-AND-COMPILER-DESIGN-LABORATORY-10CSL68--->View question

Taged users:

Likes:
Be first to like this question

Dislikes:
Be first to dislike this question
#define N 10

main( )
{
int i,j,n;
float median,a[N],t;

printf("Enter the number of items\n");
scanf("%d", &n);
/* Reading items into array a  */

printf("Input %d values \n",n);
for (i = 1; i <= n ; i++)
scanf("%f", &a[i]);
/* Sorting begins */
for (i = 1 ; i <= n-1 ; i++)
{     /* Trip-i begins  */
for (j = 1 ; j <= n-i ; j++)
{
if (a[j] <= a[j+1])
{ /* Interchanging values */

t = a[j];
a[j] = a[j+1];
a[j+1] = t;
}
elsecontinue ;
}
} /* sorting ends */
/* calculation of median  */
if ( n % 2 == 0)
median = (a[n/2] + a[n/2+1])/2.0 ;
else
median = a[n/2 + 1];

/*  Printing */
for (i = 1 ; i <= n ; i++)
printf("%f  ", a[i]);
printf("\n\nMedian is %f\n", median);

}

Likes:
Be first to like this answer

Dislikes:
Be first to dislike this answer

### Watch more videos from this user Here

Learn how to upload a video over here

Lets together make the web is a better place

We made eduladder by keeping the ideology of building a supermarket of all the educational material available under one roof. We are doing it with the help of individual contributors like you, interns and employees. So the resources you are looking for can be easily available and accessible also with the freedom of remix reuse and reshare our content under the terms of creative commons license with attribution required close.

You can also contribute to our vision of "Helping student to pass any exams" with these.