def add( x , y ) z = [] x.length.times { |i| z[ i ] = x[ i ] + y[ i ] } return z end a = [ 3 , 6 , 2 , 4 , 10 , 7 ] b = [ 5 , 8 , 1 , 0 , 7 , 10 ] c = add( a , b ) c.length.times { |i| printf( "%d " , c[ i ] ) } printf( "\n" )