heatherhb

Problem 9

May 22nd, 2011
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include<iostream>
  2. #include<cmath>
  3. using namespace std;
  4.  
  5. int main() {
  6.     int c = 1;
  7.  
  8.     for(int a = 1; a < 1000; a++) {
  9.         for(int b = 1; b < 1000; b++) {
  10.             if(a == b)//one must be less than the other
  11.                 b++;
  12.             c = sqrt(pow(a, 2) + pow(b, 2));
  13.             if(a + b + c == 1000)
  14.                 cout << a*b*c << endl;
  15.         }
  16.     }
  17.     return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment