function s = card_suit ( n )

%*****************************************************************************80
%
%% card_suit() is given the index of a card and returns its suit.
%
%  Discussion:
%
%                                                   Suit:
%    index:  1  2  3  4  5  6  7  8  9 10 11 12 13   'H'
%           14 15 16 17 19 19 20 21 22 23 24 25 26   'C'
%           27 28 29 30 31 32 33 34 35 36 37 38 39   'D'
%           40 41 42 43 44 45 46 47 48 49 50 51 52   'S'
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    15 April 2022
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N: the card index.  1 <= index <= 52.
%
%  Output:
%
%    character S: the card suit.  suit is 'H', 'C', 'D' or 'S'.
%
  suits = [ 'H', 'C', 'D', 'S' ];
  suit_index = floor ( ( abs ( n ) - 1 ) / 13 ) + 1;
  s = suits(suit_index);

  return
end

