function a = r8vec_running_average ( n, v )

%*****************************************************************************80
%
%% r8vec_running_average() computes the running average of an R8VEC.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    21 February 2016
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N, the number of items.
%
%    real V(N), the data.
%
%  Output:
%
%    real A(N+1), the running average.  A(I) is the average value
%    of the first I-1 values in V.
%
  a = zeros ( n + 1, 1 );
%
%  Sum.
%
  for i = 2 : n + 1
    a(i) = a(i-1) + v(i-1);
  end
%
%  Average.
%
  a(2:n+1) = a(2:n+1) ./ ( 1 : n )';

  return
end
