這個(gè)m和n怎么不運(yùn)算呀??!
import java.util.Scanner;
class YiTi{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
System.out.println("請(qǐng)輸入第一個(gè)整數(shù)");
int m =sc.nextInt();
System.out.println("請(qǐng)輸入第二個(gè)整數(shù)");
int n = sc.nextInt();
if(m>0&&n>0){
int temp;
if(m>n){
temp = m%n;
temp = n%temp;
if(temp==0){
System.out.println("最大公約數(shù)"+temp);
}
}else{
temp=n%m;
temp=m%temp;
if(temp==0){
System.out.println("最大公約數(shù)"+temp);
}
}
}else{
System.out.println("輸入錯(cuò)誤");
}
}
}
大家?guī)兔?lái)看看??!
胡說(shuō)叔叔
2019-03-01 10:31:33