Monday, March 16, 2015

11388 - GCD LCM (UVa)


#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;

int main()
{
    int t;
    int G, L;
    scanf("%d", &t);
    while(t--)
    {
      scanf("%d%d", &G, &L);
      if(L%G==0)
        printf("%d %d\n", G, L);
      else
        printf("-1\n");
    }
}



No comments:

Post a Comment

Compare equality of two string in C

#include <stdio.h> #include<string.h> int main() {     char* country = "Bangladesh";     char* country2;     ...