You are viewing a single comment's thread. Return to all comments →
One direct solution is:
static int squares(int a, int b) { int count=0; for(int i=1;i<=Math.sqrt(b);i++) { int x= i*i; if((x>=a) && (x<=b)) count++; } return count; }
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 →
One direct solution is: