SHARE
TWEET

Untitled

a guest Mar 18th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int divcount(long long n){
  4.     while(n%2==0){
  5.         n=n/2;
  6.         cout<<"    "<<"2"<<endl;
  7.  
  8.     }
  9.     for(long long i=3;i*i<=n;i+=2){
  10.         while(n%i==0){
  11.             n=n/i;
  12.             cout<<"    "<<i<<endl;
  13.  
  14.         }
  15.     }
  16.     if(n>2){
  17.            cout<<"    "<<n<<endl;
  18.  
  19.     }
  20. }
  21. int main()
  22. {
  23.     long long n;
  24.    while(cin>>n)
  25.    {
  26.     if(n==-1){
  27.         break;
  28.     }
  29.     divcount(n);
  30.    }
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top