请问怎样判断一个数是否被整除呀,急,请帮帮忙吧,谢谢各位老大啦

解决方案 »

  1.   

    这要用到求模的函数Mod(),如果Mod(数字)为0,则括号内的数字是整数,否则为小数
      

  2.   

    我是这样做的:
    dim a as integer
    dim b as integerif a/b <> a\b then
       ’不能整除
    else
       ’可以整除
    end if
      

  3.   

    mod是运算符吧比如
    if x mod 12 = 0 then msgbox "x能被12整除"
      

  4.   

    dim a as integer
    dim b as integerif a\b*b=a then
       msgbox "可以整除"
    else
       msgbox "不能整除"
    end if
      

  5.   

    function IsInt(x as variant,y as variant) as boolean
             const eps=0.00001
             
             if abs(x-round(x/y)*y)<eps then
                IsInt=true
             else
                IsInt=false
             end if
    end function