Computer Programming Contest Preparation

ToolBox - Source for: 113/11388/a.c



/home/toolbox/public_html/solutions/113/11388/a.c
    1 #include <stdio.h>
    2 #include <string.h>
    3 #include <sys/types.h>
    4 #include <sys/stat.h>
    5 #include <fcntl.h>
    6 #include <stdlib.h>
    7 #include <math.h>
    8 #include <stdint.h>
    9 
   10 #define TRUE  (1 == 1)
   11 #define FALSE (1 != 1)
   12 
   13 #define DEBUG if (FALSE)
   14 
   15 /* fprintf(stderr, "functionName: message", varslist); */
   16 
   17 /*
   18  *  Author: Isaac Traxler
   19  *    Date: 2017-01-22
   20  * Purpose: fun
   21  * Problem: 11388 - GCD LCM
   22  */
   23 
   24 /*
   25  * This template reads data a specified number of times.
   26  */
   27 
   28 int numberOfTimes;
   29 int gcd;
   30 int lcm;
   31 
   32 void init()
   33 {
   34     /* FUNCTION init */
   35     scanf("%d ", &numberOfTimes);
   36 } /* FUNCTION init */
   37 
   38 void dump()
   39 {
   40     /* FUNCTION dump */
   41 } /* FUNCTION dump */
   42 
   43 void getInput()
   44 {
   45     /* FUNCTION getInput */
   46     scanf(" %d %d ", &gcd, &lcm);
   47 } /* FUNCTION getInput */
   48 
   49 void process()
   50 {
   51     /* FUNCTION process */
   52     if (0 == (lcm % gcd))
   53         {
   54             printf("%d %d\n", gcd, lcm);
   55         }
   56     else
   57         {
   58             printf("-1\n");
   59         }
   60 } /* FUNCTION process */
   61 
   62 int main()
   63 {
   64     /* main */
   65     int i;
   66 
   67     init();
   68     for (i=0; i<numberOfTimes; i++)
   69         {
   70             /* while */
   71             getInput();
   72             process();
   73         } /* while */
   74 
   75     return EXIT_SUCCESS;
   76 } /* main */
   77 
   78