Advertisement
Josif_tepe

Untitled

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