Advertisement
rotti321

Descompunerea in factori primi [IMPORTANT]

May 31st, 2021
817
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     int x,y=1,d=2,p;
  8.     cin>>x;
  9.     while(x>1){
  10.         p=0;
  11.         while(x%d==0){
  12.             p++;
  13.             x=x/d;
  14.         }
  15.         if(p!=0){
  16.             y=y*d;
  17.         }
  18.         d++;
  19.     }
  20.     cout<<y;
  21. }
Advertisement
RAW Paste Data Copied
Advertisement