fork(3) download
  1. #include <stdio.h>
  2. #include <math.h>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int lp,liczba,dzielnik,dodawanie;
  8. scanf("%d",&lp);
  9. for(int i=0; i<lp; i++)
  10. {
  11. dzielnik=2;
  12. dodawanie=1;
  13. scanf("%d",&liczba);
  14. if(liczba==1) {printf("1\n");}
  15. else
  16. {
  17. while(liczba>1)
  18. {
  19. if((liczba%dzielnik)==0)
  20. {
  21. liczba/=dzielnik;
  22. if(liczba==1) {printf("%d\n",dzielnik);}
  23. else {printf("%d*",dzielnik);}
  24. }
  25. else if(dzielnik>=sqrt(liczba)) {printf("%d\n",liczba); break;}
  26. else {dzielnik+=dodawanie;}
  27. dodawanie=2;
  28. }
  29. }
  30. }
  31. return 0;
  32. }
  33.  
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
Standard output is empty