Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n, p = 0, d = 3;
- cin >> n;
- while(n % 2 == 0)
- {
- ++p;
- n /= 2;
- }
- if(p) cout << 2 << " "; // faci ce vrei tu
- while(n != 1)
- {
- p = 0;
- while(n % d == 0)
- {
- ++p;
- n /= d;
- }
- if(p) cout << d << " ";
- d += 2;
- if(d * d > n) d = n;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement