Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.28 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6.     int n;
  7.     cin >> n;
  8.  
  9.     for(int i=2;i<=sqrt(n);i++){
  10.         while (n % i == 0)
  11.         {
  12.             cout << i << " ";
  13.             n /= i;
  14.         }
  15.     }
  16.     if ( n != 1) cout << n;
  17.  
  18.  
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement