fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. class PythagoreanTriplet {
  4.  
  5. public static void main(String[] args) {
  6. int lim=1000/3;
  7. for (int i = 2; i <=lim; i++) {
  8. for (int j = i+1; j <= lim; j++) {
  9. int c = j*j+i*i,
  10. b=j*j-i*i,
  11. a=2*i*j;
  12. if(1000==a+b+c)System.out.println("product: "+(a*b*c));
  13. }
  14. }
  15. }
  16.  
  17. }
Success #stdin #stdout 0.1s 320256KB
stdin
Standard input is empty
stdout
product: 31875000