Advertisement
icatalin

Varianta 4 2007 sub 3 prob 2 netestat

Jan 7th, 2015
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int prim(int x)
  6. {
  7.     int j;
  8.     for(j=2;j<=x/2;j++)
  9.         if (x%j==0)
  10.         return 1;
  11.     return 0;
  12. }
  13.  
  14. int produs(int a)
  15. {
  16.     int i,p=1;
  17.     for (i=2;i<=a/2;i++)
  18.         if (a%i==0 && prim(i)==0)
  19.         p=p*i;
  20.     return p;
  21. }
  22.  
  23. int main()
  24. {
  25.     int a,b.c;
  26.     cin>>a>>b>>c;
  27.     if (produs(a)==probus(b) && produs(b)==produs(c))
  28.         cout<<"DA";
  29.     else
  30.         cout<<"NU";
  31.    
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement