Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int x, p=0;
- cin>>x;
- for(p=0;x%2==0;x/=2,p++);
- if(p>0)
- cout<<"2^"<<p<<endl;
- for(int d=3;d*d<=x;d+=2);
- {
- for(p=0;x%d==0;x/=2,p++);
- if(p>0)
- cout<<d<<"^"<<p<<endl;
- }
- if(x!=1)
- cout<<x<<"^";
- return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement