Advertisement
Josif_tepe

Untitled

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