wifi 万能钥匙pc版:JAVA 编程

来源:百度文库 编辑:中科新闻网 时间:2024/04/28 01:24:43
import java.io.*;
class b
{
public static void main(String args[])throws IOException
{BufferedReader buf;
String str1,str2;
int i,x,y,m,num;
buf=new BufferedReader(new InputStreamReader(System.in));
System.out.print("Intput 1:");
str1=buf.readLine();
x=Integer.parseInt(str1);
System.out.print("Intput 2:");
str2=buf.readLine();
y=Integer.parseInt(str2);
{if(x-y>0)
m=x/2;
else m=y/2;
}
for(i=1;i<=m;i++)
{
if(x%i=0)
{if(y%i=0) num=i;
}
}
System.out.println("最大公因数:"+num);
}
}

我在编译的时候说我有两处错误!可我又不知道到底为什么错了!
在21-22行的两个“%”那有错误!请各位老师教导一下谢谢!