1
代码如下:
public class gongyueshu
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
while (sc.hasNext())
{
int a=sc.nextInt();
int b=sc.nextInt();
if (a<=0||b<=0)
{
return;
}
while (a!=0)
{
int temp=a;
a=b%a;
b=temp;
}
System.out.println(b);
}
sc.close();
}
}版权声明:本文为博主原创文章,未经博主允许不得转载。
原文:http://blog.csdn.net/zzc8265020/article/details/46923959