Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main() {
- int x;
- cin >> x;
- int koren = sqrt(x);
- for(int i = 1; i <= koren; i++) {
- if(x % i == 0) {
- cout << i << " ";
- if(i != x / i) {
- cout << x / i << " " << endl;
- }
- }
- }
- return 0;
- }
- // 1, 2, 4, 8, 16, 22, 24, 28, 36, 42, 44, 48, 56
- // 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13
- // 2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 44, 48, 52
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement