Advertisement
Dizzy3113

Untitled

Nov 3rd, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. void numar(int x, int &nrp)
  6. {
  7. nrp=0;
  8. for(int i=2; i<=x; i++)
  9. {
  10. int d=0;
  11. for(int j=2; j<i/2; j++)
  12. if(i%j==0)
  13. d++;
  14. if(d==0)
  15. nrp++;
  16. }
  17. }
  18. int main()
  19. {
  20. int a,b,p1,p2;
  21. cin>>a;
  22. cin>>b;
  23. if(a>b)
  24. {
  25. int aux=a;
  26. a=b;
  27. b=a;
  28. }
  29. numar(a, p1);
  30. numar(b, p2);
  31. if(p2-p1)
  32. cout<<"DA";
  33. else
  34. cout<<"NU";
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement