Advertisement
Dizzy3113

Untitled

Nov 10th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int divizor(int a, int &d)
  5. {
  6. for(int i=2; i<=a; i++)
  7. {
  8. if(a%i==0)
  9. {
  10. d=i;
  11. i=a;
  12. }
  13. }
  14. }
  15.  
  16. int main()
  17. {
  18. int d=0,x;
  19. cin>>x;
  20. divizor(x, d);
  21. if(d==x)
  22. cout<<"DA";
  23. else
  24. cout<<"NU";
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement