Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- problema 405
- #include <iostream>
- using namespace std;
- int main()
- {
- int n,ok=0,d=2,s=0,a;
- cin>>n;
- while (n!=0){
- cin>>a;
- ok=0;
- d=2;
- while (d*d<=a && ok==0){
- if (a%d==0)
- ok=1;
- d++;
- }
- if (ok==0)
- while (a!=0){
- s=s+(a%10);
- a=a/10;
- }
- n--;
- }
- cout<<s;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement