Advertisement
Guest User

Untitled

a guest
Jan 19th, 2020
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void DescFactPrimi (int n);
  5.  
  6. int main()
  7. {
  8. int n;
  9. cin >> n;
  10.  
  11. DescFactPrimi (n);
  12.  
  13. return 0;
  14. }
  15.  
  16. void DescFactPrimi(int n)
  17. {
  18.  
  19. int d = 2;
  20.  
  21. while (d <= n)
  22. {
  23. while (n % d == 0)
  24. {
  25. cout << d << ' ';
  26. n /= d;
  27. }
  28.  
  29. d++;
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement