题解 | #求最小公倍数#

求最小公倍数

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;
}


全部评论

相关推荐

不愿透露姓名的神秘牛友
07-10 11:27
明天又是董事长面,啥时候是个头啊
在太阳里长大的人:公司就仨人吧😂
点赞 评论 收藏
分享
06-07 19:59
门头沟学院 C++
补药卡我啊😭:都快15年前的了还在11新特性
你的简历改到第几版了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务