function x = r8vec_shift ( n, x, k )

%*****************************************************************************80
%
%% R8VEC_SHIFT shifts entries of an R8VEC right by K positions.
%
%  Discussion:
%
%    The first K entries of the output vector will be 0.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    02 August 2018
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, integer N, the number of entries.
%
%    Input, real X(N), the vector to be shifted.
%
%    Input, integer K, the amount by which each entry is to
%    be shifted.  SHIFT should be nonnegative.
%
%    Output, real X(N), the shifted vector.
%
  y(1:n) = x(1:n);

  x = zeros ( size ( x ) );

  ilo = max ( 1, 1 + k );
  ihi = min ( n, n + k );

  x(ilo:ihi) = y(ilo-k:ihi-k);

  return
end
