/*
 * Description: Show all tuples of Chinese remainders for two moduli.
 * Usage: chtable a b
 * Parameter a: first moduli
 * Parameter b: second moduli
 * Copyright: Daniel Tisza, 2010
 * All rights reserved
 */

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char* argv[])
{
  int a;
  int b;
  int m;
  int i;

  if (argc != 3) /* validate argument count */
  {
    return 0;
  }

  a = 0;
  a = atoi(argv[1]);

  b = 0;
  b = atoi(argv[2]);
  
  m = a * b;

  for (i = 0; i < m; i++)
  {
    printf("%d = (%d, %d)\n", i, i % a, i % b);
  }
}

