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