Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int val;
- cout << "Enter the number: ";
- cin >> val;
- if (val % 2) {
- cout << val << "\n";
- for (int i = val / 3; i >= 1; i -= 2)
- if ((val % i) == 0) cout << i << "\n";
- }
- else {
- cout << val << "\n";
- for (int i = val / 2; i >= 1; i--)
- if ((val % i) == 0) cout << i << "\n";
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement