Advertisement
alex326

Untitled

Jan 22nd, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. problema 405
  2.  
  3. #include <iostream>
  4. using namespace std;
  5. int main()
  6. {
  7. int n,ok=0,d=2,s=0,a;
  8. cin>>n;
  9. while (n!=0){
  10. cin>>a;
  11. ok=0;
  12. d=2;
  13. while (d*d<=a && ok==0){
  14. if (a%d==0)
  15. ok=1;
  16. d++;
  17. }
  18. if (ok==0)
  19. while (a!=0){
  20. s=s+(a%10);
  21. a=a/10;
  22. }
  23. n--;
  24. }
  25. cout<<s;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement