Advertisement
Guest User

Untitled

a guest
Oct 17th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void czynniki(long int n)
  6. {
  7. int pom = n;
  8. int dzielnik = 2;
  9. cout<<1<<endl;
  10. while(n>1)
  11. {
  12. if(n%dzielnik==0)
  13. {
  14. cout<<n<<" | "<<dzielnik<<endl;
  15. n/=dzielnik;
  16. }else dzielnik++;
  17. }
  18.  
  19. }
  20.  
  21. int main()
  22. {
  23. long int n;
  24. cin>>n;
  25. czynniki(n);
  26.  
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement