Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- void Divisors(int n) {
- for (int i = 1; i <= (int) sqrt(n); i++) {
- if (n % i == 0) {
- if (n / i == i) {
- cout << i;
- } else {
- cout << i << " " << n / i << " ";
- }
- }
- }
- }
- int main() {
- int n;
- cin >> n;
- Divisors(n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement