Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int counter = 0;
- int itog = 0;
- int a = 2;
- int b;
- cin >> a;
- while (a != 0) {
- int b = a;
- while (a != 0) {
- counter += a % 10;
- a /= 10;
- }
- bool flag = 1;
- for (int i = 1; i != counter; i++) {
- if (i != 1 && counter % i == 0) {
- flag = 0;
- break;
- }
- }
- if (flag)
- itog++;
- counter = 0;
- cin >> a;
- }
- cout << itog;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement