• + 0 comments
    public static int squares(int a, int b) {
            int min = (int)Math.ceil(Math.sqrt(a));
            int max = (int)Math.floor(Math.sqrt(b));
            int i = min;
            int result = 0;
            while(i<=max){
                if(Math.pow(i,2)>=a || Math.pow(i,2)<=b)
                    result++;
                i++;
            }
            return result;
        }