➤ Problem Link : FACT0
👉 Hint : edit please
✅ C++ Solution :
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
ll n;
while(1)
{
cin>>n;
if(n==0)
break;
ll i;
for(i=2;i*i<=n;i++)
{
int cnt=0;
while(n%i==0)
{
cnt++;
n/=i;
}
if(cnt>0)
cout<<i<<"^"<<cnt<<" ";
}
if(n!=1)
cout<<n<<"^1";
cout<<endl;
}
return 0;
}
Thank you for your patience reading. If you enjoyed this post, I’d be very grateful if you’d help it spread by emailing it to a friend, or sharing it on Whatsapp or Facebook.
😇Happy Learning!!
