problem link :: http://cpbook.subeen.com/2012/11/maximum-minimum-number.html
soliution ::
int main()
{
int i,j,k,l,n,arr[10],p;
scanf("%d", &n);
for(i=0;i<n;i++)
{
for(j=0;j<5;j++)
{
scanf("%d",&arr[j]);
}
for(k=0;k<5-1;k++)
{
for(l=k+1;l<5;l++)
{
if(arr[k]>arr[l])
{
p=arr[k];
arr[k]=arr[l];
arr[l]=p;
}
}
}
printf("%d %d\n",arr[4],arr[0]);
}
return 0;
}
No comments:
Post a Comment