题解 | #求最小公倍数#

求最小公倍数

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

#include <stdio.h>

int main() {
    int a, b;

    scanf("%d %d",&a,&b);

    int x;
    x = (a>b) ? a:b;
 //   printf("%d\n", x);
    int i = 2;
    int num = x;
    while ((num%a != 0 || num%b != 0) == 1) {
    num=x*i;
    i++;
    }

        printf("%d\n", num);

    return 0;
}

全部评论

相关推荐

ming_ri:后端依旧稳定发挥
点赞 评论 收藏
分享
06-26 17:24
已编辑
宁波大学 golang
迷失西雅图:别给,纯kpi,别问我为什么知道
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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