Advertisement
Guest User

Untitled

a guest
Oct 15th, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int counter = 0;
  6. int itog = 0;
  7. int a = 2;
  8. int b;
  9. cin >> a;
  10. while (a != 0) {
  11. int b = a;
  12. while (a != 0) {
  13. counter += a % 10;
  14. a /= 10;
  15. }
  16. bool flag = 1;
  17. for (int i = 1; i != counter; i++) {
  18. if (i != 1 && counter % i == 0) {
  19. flag = 0;
  20. break;
  21. }
  22. }
  23. if (flag)
  24. itog++;
  25. counter = 0;
  26. cin >> a;
  27. }
  28. cout << itog;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement