View Code of Problem 76

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

Double click to view unformatted code.


Back to problem 76