heatherhb

Problem 9 v2

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