Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n, d, p=0, i, s=0;
- cout<<"n="; cin>>n;
- for(d=2; d<=n/2; d++)
- {
- if(n%d==0)
- {
- p=0;
- for(i=2; i<=d/2; i++)
- {
- if(d%i==0)
- p++;
- }
- if(p==0)
- {
- s=s+d;
- cout<<d<<" ";
- }
- }
- }
- cout<<"Suma divizorilor primi este "<<s;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment