Advertisement
CLazStudio

q198991558

Mar 14th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n;
  8.     cin >> n;
  9.  
  10.     int i = 2; // чтобы не выводило 1
  11.     while(i <= n)
  12.     {
  13.         if(n % i == 0)
  14.         {
  15.             cout << i << endl;
  16.             n /= i;
  17.         }
  18.         else i++;
  19.     }
  20.  
  21.     return 0;
  22. }
  23. //Источник: http://www.programmersforum.ru/showpost.php?p=696588&postcount=7
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement