Advertisement
rotti321

sim BAC2022 SIII ex1

May 23rd, 2022
737
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. #include <cstring>
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. void rest(int x,int y,int n,int &k)
  6. {
  7.     for(k=n;k>0;k--)
  8.     {
  9.       if(k%x==2&&k%y==2)
  10.       {
  11.         return; //iesire din fct void
  12.       }
  13.     }
  14.     k=0;
  15. }
  16. int main() {
  17.     int x,y,n,k;
  18.     cin>>x>>y>>n;
  19.     rest(x,y,n,k);
  20.     cout<<k;
  21.     return 0;
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement