Least common multiple
Time limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 39946 Accepted Submission (s): 22340
Problem description given two positive integers, calculate the least common multiple of these two numbers.
Input inputs contain multiple sets of test data, with only one row per group, including two positive integers not greater than 1000.
Output for each test case, give the least common multiple of these two numbers, and each instance outputs a row.
Sample Input
Ten -
Sample Output
70
Sourcepoj
Recommendeddy | We have carefully selected several similar problems for you:1061 1005 1071 1019 1425
1#include <stdio.h>2 3 intGCD (intAintb)4 {5 intI, t, temp;6 for(i=1; i<=a; i++)7 {8 if(a%i = =0&& b%i = =0)9temp =i; Ten } One returna*b/temp; A } - - intMain () the { - intA, B; - while(~SCANF ("%d%d", &a, &b)) - { + inttemp =gcd (A, b); -printf"%d\n", temp); + } A return 0 ; at}
Hangzhou Electric 1108--Least common multiple