n = 10 max = 0 i = 1 while i <= n do a = rand( 100 ).to_i printf( "%d番目の乱数は%dです\n" , i , a ); if a > max then max =a; end i += 1 end printf( "-----------\n" ); printf( "最大値は%dです\n" , max );