Skip to content

Instantly share code, notes, and snippets.

@peter279k
Created December 22, 2015 02:06
Show Gist options
  • Save peter279k/9005d0062d8530bd6769 to your computer and use it in GitHub Desktop.
Save peter279k/9005d0062d8530bd6769 to your computer and use it in GitHub Desktop.
import java.util.*;
public class main{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int count = 0;
String result = "";
while(true) {
int a = input.nextInt();
int b = input.nextInt();
if(a == 0 && b == 0)
break;
for(int i=a;i<=b;i++) {
int number = (int)Math.sqrt(i);
boolean check = (number * number == i);
if(check)
count++;
}
result += count + "\r\n";
count = 0;
}
System.out.print(result);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment