GCD and LCM problem of begginer section

#include <stdio.h>
#include <string.h>

int main(void) {
int test,hcf, a, b, c, d;

scanf ("%d\n", &test);

while (test--) {  
	hcf = 0;
    scanf ("%d %d", &a, &b);
    c = a; 
    d = b;
    while(a!=b){
    	if(a > b)
    		a -= b;
    	else
    		b -= a;
	}
	hcf = a;
	
	
    
    printf("%d %d\n", hcf, (c*d)/hcf);
}
return 0;

}

this program of mine giving wrong answer but has been submitted correctly by other use in the solution section
what us the problem ?

Can you provide the link to Problem ??

1 Like

send a link to the problem please

1 Like