Advertisement
Josif_tepe

Untitled

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