fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n;
  6. cin >> n;
  7. int t[n];
  8. for (int i = 0; i < n; i++) {
  9. cin >> t[i];
  10. int num = t[i];
  11. for (int j = 2; j <= num && num > 1; ) {
  12. if (num % j == 0) {
  13. cout << j << " ";
  14. num /= j;
  15. } else {
  16. j++;
  17. }
  18. }
  19. cout << "\n";
  20. }
  21. return 0;
  22. }
  23.  
Success #stdin #stdout 0.01s 5292KB
stdin
5
2
3
6
4
6
stdout
2 
3 
2 3 
2 2 
2 3