HDU 2.1.1最小公倍数

来源:互联网 发布:linux创建文件目录 编辑:程序博客网 时间:2024/06/06 09:53

http://acm.hdu.edu.cn/game/entry/problem/show.php?chapterid=2&sectionid=1&problemid=1

import java.util.Scanner;public class Main{public static int fun(int a ,int b){for(int i=1; ;i++){if(i%a==0 && i%b==0) return i;}}public static void main(String[] args) {int s,a,b;Scanner in = new Scanner(System.in);while(in.hasNext()){a = in.nextInt();b = in.nextInt();s = fun(a,b);System.out.println(s);}}}


0 0