题解 | #求最小公倍数#

求最小公倍数

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

#include #include #include using namespace std; int func(int n1,int n2) { for(int i=n1;i<=n1n2;++i) { if(i%n1==0&&i%n2==0) return i; } return n1n2; } int main() { int n1,n2; while(cin>>n1>>n2) { cout<<func(n1,n2)<<endl; } return 0; }

全部评论

相关推荐

我就是0offer糕手:北大不乱杀
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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