编辑代码

#include<stdio.h>

void main()
{
	int a[12];
	int i,j,temp;
	printf("为数组元素赋值:\n");
	
	for(i = 0; i < 12; i++)
	{
		printf("请输入\n");
        printf("a[%d]=",i);
		scanf("%d",&a[i]);
	}
	
	for(i = 0; i < 12; i++)
	{
		for(j = i + 1 ; j < 12; j++)
			if(a[j]<a[i])
			{
				
				temp = a[i];
				a[i] = a[j];
				a[j] = temp;
			}
	}
	
	
	for (i = 0; i < 12; ++i)
	{
		printf("%d\t",a[i]);
		if (i == 5)
		{	
            printf("\n");
        }
    }
	printf("\n");
    
    int b = 0;
    for (i = 0; i < 12; ++i){
        b = b + a[i];
    }
    int c = b / 12;
    
    for(i = 0; i < 12; ++i){
        if (a[i] > c) {
            printf("%d\t",a[i]);
            
        }
        if ((i + 1) % 3 == 0)
	    {	
            printf("\n");
        }
    }

}