def multi( x , y ) a = 0 x.length.times { |i| a += ( x[ i ] * y[ i ] ) } return a end def add( x , y ) z = [] x.length.times { |i| z[ i ] = x[ i ] + y[ i ] } return z end def sub( 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" ) d = sub( a , b ) d.length.times { |i| printf( "%d " , d[ i ] ) } printf( "\n" ) printf( "ÆâÀѤÏ%d¤Ç¤¹\n" , multi( c , d ) )