fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. void print_pfs(int n) {
  5. for (int i = 2; i * i <= n; i++) {
  6. while (n % i == 0) {
  7. cout << i << '\n';
  8. n /= i;
  9. }
  10. }
  11. }
  12.  
  13. int main() {
  14. int n;
  15. cin >> n;
  16. print_pfs(n);
  17. return 0;
  18. }
Success #stdin #stdout 0s 5324KB
stdin
Standard input is empty
stdout
5