brospresident

Untitled

Oct 14th, 2021
719
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int solutie(int M, int N, int P) {
  6.     if (N == P) return M;
  7.     int raspuns = M + P;
  8.  
  9.     if (raspuns > N) raspuns -= N;
  10.     return raspuns;
  11. }
  12.  
  13. int main () {
  14.     int M, N, P;
  15.     cin >> M >> N >> P;
  16.  
  17.     cout << solutie(M, N, P) << endl;
  18.     return 0;
  19. }
RAW Paste Data