Advertisement
Guest User

рекурсия 3,5

a guest
Sep 15th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.27 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int recurs(int N)
  4. {
  5.   int l=0;
  6.   if ((N==0) || (N%3==0) || (N%5==0))
  7.   l=1;
  8.   else
  9.   recurs(N-5);
  10.   return l;
  11. }
  12. int main ()
  13. {
  14.   int N, b=0;
  15.   cin >> N;
  16.   N-=1;
  17. if (recurs(N)==1)
  18. cout << "yes";
  19. else cout << "no";
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement