Advertisement
TwITe

Untitled

Sep 13th, 2017
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. bool current_variables_is_arithmetic_progression(const int& a, const int& b, const int& c) {
  6.     if (pow(c, 2) - pow(b, 2) == pow(b, 2) - pow(a, 2)) {
  7.         return true;
  8.     }
  9.     return false;
  10. }
  11.  
  12. void task() {
  13.     int a = 32, b, c;
  14.     while (true) {
  15.         for (int b = a + 1; b < 100; b++) {
  16.             for (int i = 100; i > b; i--) {
  17.                 c = i;
  18.                 if (current_variables_is_arithmetic_progression(a, b, c)) {
  19.                     cout << pow(b, 2);
  20.                 }
  21.             }
  22.         }
  23.         a++;
  24.     }
  25. }
  26.  
  27. int main() {
  28.     task();
  29.  
  30.     system("PAUSE");
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement