Advertisement
Guest User

Untitled

a guest
Mar 19th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.75 KB | None | 0 0
  1. import static java.lang.Math.pow;
  2. import static java.lang.Math.sqrt;
  3. import java.util.Scanner;
  4.  
  5.  
  6. public class Main {
  7.  
  8.     /**
  9.      * @param args the command line arguments
  10.      */
  11.     public static void main(String[] args) {
  12.         // TODO code application logic here
  13.         Scanner input=new Scanner(System.in);
  14.         while(input.hasNext()){
  15.         int x,y,i,count=0;
  16.         x=input.nextInt();
  17.         y=input.nextInt();
  18.         if(x==0&&y==0){
  19.             break;
  20.         }
  21.         else{
  22.         for(i=x;i<=y;i++){
  23.             int temp=(int) Math.sqrt(i);
  24.            
  25.             if(i==Math.pow(temp,2)){
  26.             count++;
  27.         }
  28.         }
  29.             System.out.println(count);
  30.         }
  31.         }
  32.        
  33.     }
  34.    
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement