Hi, Im hoping someone can give me some guidance point me in the right direction with an assignment I have.

I have done the first part, i think??, which is to allow the user to enter up to 10 numbers in total with a choice of yes or no if they want to continue entering up to that point. They are to be stored in an array.

Now the bit I am struggling with is, once the numbers have been entered the program should work out the total value, smallest number, largest number, the average, display the numbers in ascending order and also show the range, all to be displayed on screen. I've used bubblesort to reorganise the numbers but Im not really sure how it works.

I feel completly lost and it needs to be finished for next week.

heres what I have done so far:

·

Code:`#include<stdio.h>`

Thanks for looking, hope someone has time to help me out!Code:

intobtainNumber(intnumbers[]);

voiddisplaynumbers(intnumbers[10],intlastIndex);

voidbubbleSort(intnumbers[],constintarrayLength);

voidswap(int*p,int*q);

intmain()

{

constintarraySize = 10;

intnumbers[arraySize];

intlastIndex;

lastIndex; obtainNumber(numbers);

intlastIndex = 10;

printf ("starting array contents \n");

displayNumbers (numbers, lastIndex);

bubbleSort (numbers, lastIndex + 1);

printf (" \n After sorti8ng array\n");

displayNumbers (numbers, lastIndex);

system("pause");

return0;

}

intobtainNumber(intnumbers[])

{

intindex = -1;

charoption = 'y';

while(option == 'y' || option == 'Y')

{

index = index + 1;

printf("Enter a number: ");

scanf("%i", &numbers[index]);

_flushall();

if(index < 9)

{

printf("Do you want to enter another number?('y' for yes 'n' for no) ");

scanf("%c", &option);

_flushall();

}

else

{

option = 'n';

}

}

returnindex;

}

printf ("starting array contents \n");

displayNumbers (numbers, lastIndex);

bubbleSort (numbers, lastIndex + 1);

printf (" \n After sorti8ng array\n");

displayNumbers (numbers, lastIndex);

system ("pause");

return0;

}

voiddisplayNumbers (intnumbers[],intlastIndex)

{

printf ("The contents of the array is:\n");

inti = 0;

while(i <= lastIndex)

{

printf ("%i\n", numbers [i]);

i++;

}

}

voidbubbleSort (intnumbers [],constintarrayLength)

{

inti, sorted = 0;

while(sorted == 0)

{

sorted = i;

i = 1;

while(i < arrayLength)

{

if(numbers [i - 1] > numbers [i])

{

swap (&numbers[i - 1], &numbers[i]);

sorted = 0;

}

i++;

}

}

}

voidswap(int*p,int*q)

{

inttemp;

temp = *p;

*p = *q;

*q = temp;

}