function [ y, j ] = j_carry_republican ( y, j )

%*****************************************************************************80
%
%% j_carry_republican() carries year-days to years in a Republican date.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    22 June 2012
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer Y, J, the YJ date.
%
%  Output:
%
%    integer Y, J, the YJ date after carrying.
%
  while ( true )

    days = year_length_days_republican ( y );

    if ( j < days )
      break
    end

    j = j - days;
    y = y + 1;

  end

  return
end
