Advertisement
Dizzy3113

Untitled

Nov 3rd, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. int divizor(int a)
  6. {
  7.  
  8. for(int i=2; i<a/2; i++)
  9. {
  10. int div=0;
  11. for(int j=2; j<i/2; j++)
  12. {
  13. if(i%j==0)
  14. div++;
  15. }
  16. if(div==0 && a%i==0)
  17. return i;
  18. }
  19.  
  20. }
  21. int main()
  22. {
  23. int n, x, s=0;
  24. ifstream f("date.in");
  25. f>>n;
  26. for(int i=0; i<n; i++)
  27. {
  28. f>>x;
  29. s=s+divizor(x);
  30. }
  31. cout<<s;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement