zoukankan      html  css  js  c++  java
  • JS判断两个数是否能除尽

       function judgeDivisor(m, n) {
                var num = {};
                var i = 0;
                var x = parseInt(m / n);
                m = m % n;
                var result = "";
                while (m != 0 && !(m in num)) {
                    num[m] = i++;
                    result += parseInt(m * 10 / n);
                    m = m * 10 % n;
                }
                return m == 0;
            }

    方法取自

  • 相关阅读:
  • 原文地址:https://www.cnblogs.com/wanglu/p/5405734.html
Copyright © 2011-2022 走看看