I want to write a program that sorting marks of nth of students in ascending order using an array, and these marks generated randomly from (1 to 100)? How can i get the medain value of these marks? ( it may be even or odd) Like i entered 6 numbers the medain will be `3 and 4(3+4=7/2=3.5)`

and if i entered 15 numbers, the medain will be 8.

i tried to write it, but for limited number for 10 students. i want nth number of students

```
#include<iostream>
#include<iomanip>
#include<stdlib.h>
#include<time.h>
using namespace std;
void main ()
{
const int size=10;
int array[10],temp;
srand (time(0));
cout<<"\n\n";
for (int i=0;i<size;i++)
{
array= 1 +rand()%100;
cout<<array<<" ";
}
cout<<"\n\n";
for (int i=0;i<size-1;i++)
for (int j=i+1;j<size;j++)
if (array[j]<array)
{
temp = array;
array= array[j];
array[j]= temp;
}
for (int i=0;i<size;i++)
cout<<array<<" ";
cout<<"\n\n";
}
```