Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. // Euler 9.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include <math.h>
  7. using namespace std;
  8.  
  9.  
  10. int main()
  11. {
  12.     system("chcp 1252>NUL");
  13.  
  14.     const int sum = 1000;
  15.     int a;
  16.     for (a = 1; a < sum/3; a++)
  17.     {
  18.         int b;
  19.         for (b = a + 1; b < sum/2; b++)
  20.         {
  21.             int c = sum - a - b;
  22.             if (((a*a + b*b == c*c) && ((a+b+c) == 1000)));
  23.             printf("a=%d, b=%d, c=%d\n", a, b, c);
  24.         }
  25.     }
  26.  
  27.  
  28.     system("pause");
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement