Advertisement
RusSimona

pg 151 ex9

Jun 4th, 2019
94
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.  
  3. using namespace std;
  4.  
  5. int sub (int n)
  6.  
  7. {
  8. int d=2, p=0,produs=1;
  9. while(n>1)
  10. {
  11. p=0;
  12. while(n%d==0)
  13. {
  14. p++;
  15. n=n/d;
  16. }
  17. if(p) produs=produs*d;
  18. d++;
  19. }
  20. return produs;
  21. }
  22.  
  23. int main ()
  24. {
  25. int a,b,c;
  26. cin>>a>>b>>c;
  27. if( sub(a)==sub(b)&&sub(b)==sub(c))
  28. cout<<"DA";
  29. else
  30. cout<<"NU";
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement