Advertisement
Josif_tepe

Untitled

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