1028: 最小公倍数
Submit: 101 Solved: 88
Description
求两个整数M和N的最小公倍数。
Input
输入一行,包括两个整数.
Output
输出只有一行(这意味着末尾有一个回车符号),包括1个整数。
Sample Input
45 60
Sample Output
180
HINT
Source
#include<iostream>
using namespace std;
main()
{
int i,M,N,d;
cin>>M>>N;
for(i=M*N;i>=M;i--)
{
if(i%M==0&&i%N==0)d=i; //d用来暂存公倍数
}
cout<<d<<endl;
}