Java经典练习题13

/*
题目:一个整数,它加上100后是一个完全平方数,再加上168又是一个完全平方数,请问该数是多少? 
*/
public class Class13 {

public static void main(String[] args) {
for(int i = -100; i <= 100000; i++){
if((Math.sqrt(i + 100) % 1 == 0) && (Math.sqrt(i + 168) % 1 == 0)){
System.out.println(i);
}
}

}

}

猜你喜欢

转载自www.cnblogs.com/zhuozige/p/12358413.html
今日推荐