December 22, 2018
Find gCD, BCNN
Threads: Input 2 integer. Find the greatest common divisor (UCLN) and the least common multiple (BCNN) of them.
Input: A line of 2 positive integers separated by spaces.
Output: A line of 2 numbers separated by spaces that GCD, BCNN of 2 Some have.
For example:
input: 6 4 output: 2 12
You are not logged in? Log in to Submit Now!
One Comment
Add a Comment
You must be logged in to post a comment.
#include
int main(){
int n, m, mxn;
mxn = m * n;
scanf(“%d%d”, &n, &m);
while (m != n){
if (m > n) m = m – n;
else n = n – m;
}
printf(“%d %d”, m, mxn / m);
return 0;
}
Em để tạm code ở đây ạ, giờ web đang bị lỗi.