初中学的勾三股四玄五还记得吧!那请求出1 - 100之间的勾股数吧
public static void main(String[] args) {
int count = 0;
for (int a = 1; a <= 99; a++) {
for(int b = a; b<=99; b++){
for(int c = b+1;c<=100;c++){
if(a*a +b*b == c*c){
count++;
System.out.println("a的长是:" + a + "\t"+ "b的长是:" + b + "\t" + "c 的长是:" + c + "\t" + "第" +count + "次数"+count);
}
}
}
} |
|