1 package FushiExam; 2 3 public class Text_13 { 4 5 public static void main(String[] args) { 6 // 一個整數,它加上100后是一個完全平方數,再加上168又是一個完全平方數,請問該數是多少? 7 for(int i=1;i<10000;i++) { 8 if(Math.sqrt(i+100)%1==0&&Math.sqrt(i+168)%1==0) {//n%1==0 則說明沒有小數 9 System.out.println(i); 10 } 11 } 12 13 } 14 15 }