Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- int divizor(int a)
- {
- for(int i=2; i<a/2; i++)
- {
- int div=0;
- for(int j=2; j<i/2; j++)
- {
- if(i%j==0)
- div++;
- }
- if(div==0 && a%i==0)
- return i;
- }
- }
- int main()
- {
- int n, x, s=0;
- ifstream f("date.in");
- f>>n;
- for(int i=0; i<n; i++)
- {
- f>>x;
- s=s+divizor(x);
- }
- cout<<s;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement