为了账号安全,请及时绑定邮箱和手机立即绑定

最大公约数,运行错误,求解?!

最大公约数,运行错误,求解?!

LIN小黑 2018-01-12 16:14:25
import java.util.Scanner; public class Main {     public static void main(String[] args) {        // TODO Auto-generated method stub        Scanner in = new Scanner(System.in);        int a = in.nextInt();        int b = in.nextInt();        System.out.print(gongyue(a, b));    }     static int gongyue(int n, int m) {        if (m <= n)            if (n % m == 0)                return (m);            else                return gongyue(m, n % m);        else            return gongyue(m, n);    } }运行错误如下:Exception in thread "main" java.util.InputMismatchException: For input string: "123456789101112" at java.util.Scanner.nextInt(Scanner.java:2166) at java.util.Scanner.nextInt(Scanner.java:2119) at Main.main(Main.java:8)求改求解析!
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 1068 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信