heatherhb

Problem 9 v3

May 22nd, 2011
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. int a = 1;
  2. int b = 1;
  3. int c = 1;
  4. bool found = false;
  5.  
  6.  
  7. for(a = 1; a < 400 && !found; a++) {
  8.         for(b = 1; b < a && !found; b++) {
  9.             c = sqrt(pow(a, 2) + pow(b, 2));
  10.             if(a + b + c == 1000)
  11.                 found = true;
  12.         }
  13.     }
  14. cout << a*b*c << endl;
Advertisement
Add Comment
Please, Sign In to add comment