Advertisement
brospresident

Untitled

Oct 14th, 2021
1,081
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 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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement