Advertisement
Weird_Thing

Divisores situados en posiciones impares - X57795

Nov 14th, 2019
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. bool divisors_odd(int x, int y) {
  6.     if (x < 100) return ((y % (x % 10)) == 0);
  7.     else {
  8.         return (y % (x % 10) == 0) and divisors_odd(x / 100, y);
  9.     }
  10. }
  11.  
  12. int main() {
  13.     int x, y;
  14.     while (cin >> x >> y) {
  15.         if (divisors_odd(x, y)) cout << "YES";
  16.         else cout << "NO";
  17.         cout << endl;
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement