题解 | #求最小公倍数#

求最小公倍数

https://www.nowcoder.com/practice/22948c2cad484e0291350abad86136c3

#include <iostream>
#include<string>
using namespace std;
//求最小公倍数

int main() {
    int a,b;
    cin>>a>>b;
    int num=max(a,b);
    while(1){
        if(num%a==0&&num%b==0){
            cout<<num;
            break;
        }
        num++;
    }
    return 0;
}


全部评论

相关推荐

纸鹰:对他说:“你好,我是百度JAVA。”
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务