Advertisement
Josif_tepe

Untitled

Feb 24th, 2024
476
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. #include <algorithm>
  3. using namespace std;
  4.  
  5. int main() {
  6.     int p1, p2, p3;
  7.     cin >> p1 >> p2 >> p3;
  8.    
  9.     int x = p2 - p1;
  10.     if(p2 + x == p3) {
  11.         cout << p3 + x << endl;
  12.     }
  13.     else {
  14.         x = p2 / p1;
  15.         cout << p3 * x << endl;
  16.     }
  17.     return 0;
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement