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