将10个数字中最大的数输出

#include <stdio.h>
int main()
{
	int a[10]={1,2,3,4,5,6,7,11,9,10};
	int   i,j,temp;
	for(i=0;i<10;i++)
	{
		for(j=0;j<9-i;j++)
			if(a[j+1]>a[j])	
	  { 
		  temp=a[j];
		  a[j]=a[j+1];
		  a[j+1]=temp;
	  }
	}
	
		printf("%d",a[0]);
		return 0;
}

猜你喜欢

转载自blog.csdn.net/shoushou_/article/details/89433009