View Code of Problem 76

#include<stdio.h>
int sort(int a[],int n)
{
	int i,j,temp;
	for(i=0;i<n;i++)
	{
		for(j=i+1;j<n;j++)
		{
			if(a[i]>a[j])
			{
				temp = a[i];
				a[i] = a[j];
				a[j] = temp;
			}
		}
	}
	
}
void display(int a[],int n)
{
	int i;
	for(i=0;i<n;i++)
	{
		if(i!=n-1)
		printf("%d\n",a[i]);
		else
		printf("%d",a[i]);
	}
}
int main()
{
	int a[10];
	for(int i=0;i<9;i++)
	{
		scanf("%d",&a[i]);
	}
	int b;
	scanf("%d",&b);
	a[9] = b;
	sort(a,10);
	display(a,10);
	return 0;
}

Double click to view unformatted code.


Back to problem 76