编写一个函数,计算任意两个数字之间所能组成的奇数个数,数字必须是个位数。 比如:计算0~3之间能组成的奇数是: 01、03、13、21、23、31

function get(m,n){ 
        var count = 0;
        for(var i=n; i<=m; i++){
                for(var j=n; j<=m; j++){
                        if(i==j) continue;
                        if( (i*10+j)%2 != 0 ){
                                console.log(i*10+j);  
                                count++;
                        }
                }
        }
        return count;
}

猜你喜欢

转载自www.cnblogs.com/tis100204/p/10310151.html