View Code of Problem 75

#include <stdio.h>
#include <math.h>
void main() 
{
	int a[10];
	for (int i = 0; i < 10; i++)
	{
		scanf("%d", &a[i]);
	}
	for (int i = 0; i < 10; i++)
	{
		int min_index = i;
		for (int j = i+1; j < 10; j++)
		{
			if (a[j] < a[min_index])
			{
				min_index = j;
			}
		}
		int t = a[i];
		a[i] = a[min_index];
		a[min_index] = t;
	}
	for (int i = 0; i < 10; i++)
	{
		printf("%d\n", a[i]);
	}
}

Double click to view unformatted code.


Back to problem 75