Advertisement
rotti321

sim BAC 2018 SIII Ex 3.

Mar 23rd, 2018
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int nr,d=2,e,x,y;
  8.     cin>>nr;
  9.     x=1;
  10.     y=nr;
  11.     while(nr>1){
  12.         e=0;
  13.         while(nr%d==0){
  14.             nr=nr/d;
  15.             e++;
  16.         }
  17.         for(int i=1;i<=e/2;i++){
  18.             x=x*d;
  19.         }
  20.         d++;
  21.     }
  22.     y=y/(x*x);
  23.     cout<<x<<" "<<y;
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement