Module: GCD(최대 공약수)


Problem

4/10

NOC(C++)

Problem

두 자연수의 최소공배수(LCM)를 구하세요.
 
입력
입력은 109을 초과하지 않고 하나의 공백으로 구분된 두 개의 자연수입니다.
 
출력
두 숫자의 최소공배수를 출력하세요.

누락된 코드 조각을 프로그램에 붙여넣습니다.

예시
<헤드> <일># <몸>
입력 출력
1 16 20 80
Write the program below
#include <iostream>
using namespace std;

int gcd (int a, int b) {
	return b ? gcd (b, a % b) : a;
}

int lcm (int a, int b) {       
}

int main()
{   
   
   int a,b; 
    cin >> a>>b;
    cout<<lcm(a,b);
    return 0;
}       

     

Program check result

To check the solution of the problem, you need to register or log in!