Advertisement
Josif_tepe

Untitled

Dec 17th, 2021
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int p1, p2, p3;
  8.     cin >> p1 >> p2 >> p3;
  9.     int x = p2 - p1;
  10.     if (p1 + x + x == p3)
  11.     {
  12.         cout << p3 + x << endl;
  13.         return 0;
  14.     }
  15.     else
  16.     {
  17.         x = p2 / p1;
  18.         cout << p3 * x << endl;
  19.     }
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement