SelinD

9/151

Jun 4th, 2019
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. int produs(int n)
  5. {
  6. int d=2,produs=1,putere;
  7. while(n>1)
  8. {
  9. putere=0;
  10. while(n%d==0)
  11. {
  12. putere++;
  13. n=n/d;
  14. }
  15. if(putere>0) produs=produs*d;
  16. d++;
  17. }
  18. return produs;
  19. }
  20.  
  21. int main()
  22. {
  23. int a,b,c;
  24. cin>>a>>b>>c;
  25. if(produs(a)==produs(b) && produs(b)==produs(c))
  26. cout<<"DA";
  27. else
  28. cout<<"NU";
  29. }
Add Comment
Please, Sign In to add comment