double sales[10];
int index;
double largestsale,smallestsale,sum,average;


	printf("Enter Value:\n");


	//sum & average
	sum = sum+sales[index];}
	average = sum/5;

	printf("\nThe Sum is %d",sum);
	printf("\nThe Average is %d",average);

	int maxIndex = 0;
	if(sales[maxIndex] < sales[index])
	maxIndex = index;
	largestsale = sales[maxIndex];
	printf("\nLargestsale is %d",largestsale);

	int minIndex = 0;
	if(sales[minIndex] > sales[index])
	minIndex = index;
	smallestsale = sales[minIndex];
	printf("\nSmallestsale is %d",smallestsale);

return 0;
Re: sorting array 80 80

Is there a question in there somewhere?

Re: sorting array 80 80

how to sort array

Re: sorting array 80 80

Take a look at http://www.sorting-algorithms.com/bubble-sort for the most basic type of sort

Re: sorting array 80 80

can you help me? what variables am i going to plus and minus?

Re: sorting array 80 80

what variables am i going to plus and minus?

If you are sorting, you are not adding or subtracting anything. Sort your array in place. Here's one pass through the data(sorting in ascending order):

is 6 > 3, yes, so swap those elements
is 6 > 5, yes, so swap those elements
is 6 > 9 no, so leave the element alone
is 9 > 2 yes, so swap those elements

Since we know that element0 is going to be sorted with respect to element1, start at element1 and repeat the above process. As we go over the list iteration after iteration, that 2 will percolate down to the bottom. That site I gave you is great because it shows you animations. See if you can make some C code out of the pseudocode they provide there along with the details above.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.