Advertisement
Josif_tepe

Untitled

Feb 17th, 2024
732
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main() {
  6.     int b, j;
  7.     cin >> b >> j;
  8.    
  9.     int brojac = 0;
  10.     int koren = sqrt(b);
  11.     for(int i = 1; i <= koren; i += 1) {
  12.         if(b % i == 0) {
  13.             if(j % i == 0) {
  14.                 brojac += 1;
  15.             }
  16.          
  17.             if(j % (b / i) == 0 and i != b / i) {
  18.                 brojac += 1;
  19.             }
  20.         }
  21.     }
  22.     cout << brojac << endl;
  23.    
  24.     return 0;
  25.                
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement