C program that sort a list of number in non-ascending order and print the midpoint of the list
Posted by Samath
Last Updated: June 01, 2015

Write a C program that receives 11 float numbers of three significant figures from the console. Sort it in non-ascending order and print the midpoint of the list.

Solution:

#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
	float nums[11],temp; 
 
	
	for(int i=0;i<11;i++)
	{
		printf("Enter num: ");
		scanf("%f",&nums[i]); 
	}
 
	for(int i=11;i>=0;i--) 
	{ 
		for(int k=11;k>=0;k--) 
		{ 
			if(nums[i]<nums[k]) 
			{
				temp=nums[i]; 
				nums[i]=nums[k];
				nums[k]=temp; 
			}
		 } 
	 }
	
	printf ("Middle Point is %.2f\n",nums[5]); 
	
	return 0;
}