def min_max( x )
array = []
array[ 0 ] = x[ 0 ]
array[ 1 ] = x[ 0 ]
(1..x.length-1).each { |i|
if array[ 0 ] > x[ i ] then
array[ 0 ] = x[ i ]
elsif array[ 1 ] < x[ i ] then
array[ 1 ] = x[ i ]
end
}
return array
end
a = [ 3 , 5 , 1 , 4 , 10 , 7 ]
result = min_max( a )
printf( "最小値は%dで,最大値は%dです\n" , result[ 0 ] , result[ 1 ] )