#include<bits/stdc++.h>
#define ll unsigned long long int
using namespace std;
ll garvage(ll N, ll n, ll k)
{
ll i = k, p = n, j;
vector<ll>v;
v.push_back(n);
while(i>1)
{
if(p*i == N)
{
v.push_back(i);
for(j=0;j<v.size();j++)
cout << v[j] << " ";
cout << endl;
return i;
}
else if(p*i < N)
{
p *= i;
v.push_back(i);
}
else
i--;
}
return k;
}
void fact(ll n)
{
int i;
for(i=2;i<=n/2;i++)
{
if(n%i == 0)
{
ll x = garvage(n, i, i);
while(x > 2)
x = garvage(n, i, x-1);
}
}
cout << 1 << " " << n << endl;
}
int main()
{
ll n;
cout <<"Enter Any Number :: ";
cin >> n;
fact(n);
return 0;
}
#define ll unsigned long long int
using namespace std;
ll garvage(ll N, ll n, ll k)
{
ll i = k, p = n, j;
vector<ll>v;
v.push_back(n);
while(i>1)
{
if(p*i == N)
{
v.push_back(i);
for(j=0;j<v.size();j++)
cout << v[j] << " ";
cout << endl;
return i;
}
else if(p*i < N)
{
p *= i;
v.push_back(i);
}
else
i--;
}
return k;
}
void fact(ll n)
{
int i;
for(i=2;i<=n/2;i++)
{
if(n%i == 0)
{
ll x = garvage(n, i, i);
while(x > 2)
x = garvage(n, i, x-1);
}
}
cout << 1 << " " << n << endl;
}
int main()
{
ll n;
cout <<"Enter Any Number :: ";
cin >> n;
fact(n);
return 0;
}
Comments
Post a Comment