def f( x ) a = x * x return a end (1..10).each { |i| printf( "%dの二乗は%dです\n" , i , f( i ) ) }