fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int x;
  5. scanf("%d",&x);
  6.  
  7. int p=2;
  8. int temp=x;
  9. while(temp!=1&&p*p<=x){
  10. if(temp%p==0){
  11. temp/=p;
  12. printf("%d ",p);
  13. }
  14. else{
  15. p++;
  16. }
  17. }
  18. if(temp!=1) printf("%d",x);
  19. return 0;
  20. }
  21.  
Success #stdin #stdout 0s 5288KB
stdin
100
stdout
2 2 5 5