sOLUTION
#include <stdio.h>
int main()
{
int a, b, x, y,temp,GCD,LCM;
scanf("%d",&x);
scanf("%d",&y);
a=x;
b=y;
while(b!=0)
{
temp=b;
b=a%b;
a=temp;
}
GCD=a;
LCM=(x*y)/GCD;
printf("GCD=%d\n",GCD);
printf("LCM=%d\n",LCM);
return 0;
}
No comments:
Post a Comment