import java.util.Scanner;
public class Divisor1 {
//static int m;
//static int n;
int a,b;
public static void main(String[]args){
//输入两个数m,n
System.out.println("请输入第一个数m=");
Scanner in = new Scanner(System.in);
int m = in.nextInt();
System.out.println("请输入第二个数n=");
int n = in.nextInt();
int r;
while(n!=0){
r = m%n;
m = n;
n = r;
}
System.out.println(m);
}
}
:输入两个正整数m和n,求其最大公约数和最小公倍数。
最新推荐文章于 2024-04-15 23:22:59 发布