题解 | #求最小公倍数#
求最小公倍数
https://www.nowcoder.com/practice/22948c2cad484e0291350abad86136c3
#include <iostream> using namespace std; int main() { int a, b; cin >> a >> b; if (a > b) { int tmp = b; b = a; a = tmp; } int n; if (b % a == 0) { n = b; } else { for (int i = 1;i <= b;i++) { int yueshu = i * a; if (yueshu % b == 0) { n = yueshu; break; } } } cout << n ; } // 64 位输出请用 printf("%lld")