function crt_test ( )

%*****************************************************************************80
%
%% crt_test() tests crt.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    13 December 2020
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'crt_test:\n' );
  fprintf ( 1, '  crt() reconstructs a value f which satisfies\n' );
  fprintf ( 1, '    mod(f,m(i)) = r(i), 1 <= i <= n\n' );

  r = [ 2, 3, 2 ];
  m = [ 3, 5, 7 ];

  f = crt ( m, r );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  crt(m,r) returns f = %d\n', f );
%
%  Verify.
%
  n = length ( r );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  #i   m(i)  r(i)  mod(f,m(i))\n' );
  fprintf ( 1, '\n' );
  for i = 1 : n
    fprintf ( 1, '  %2d    %2d    %2d       %2d\n', i, m(i), r(i), mod ( f, m(i) ) );
  end

  return
end
