You are viewing a single comment's thread. Return to all 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; }
Seems like cookies are disabled on this browser, please enable them to open this website
Sherlock and Squares
You are viewing a single comment's thread. Return to all comments →