Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Author: Kanan Asgarli
- https://www.e-olymp.com/az/problems/842
- */
- #include <iostream>
- #include <cmath>
- using namespace std;
- int n, f;
- int main()
- {
- cin>>n;
- for(int i = 2; i <= (int)sqrt(n); i++)
- while( n % i == 0 ){
- if( f == 0 )
- cout<<i;
- else
- cout<<"*"<<i;
- n = n / i;
- f = 1;
- }
- if( n > 1 ){
- if( f == 0 )
- cout<<n;
- else
- cout<<"*"<<n;
- }
- cout<<endl;
- return 0;
- }
Add Comment
Please, Sign In to add comment