#include <iostream>
signed main() {
setlocale(LC_ALL, "Rus");
int N, _counter = 0;
std::cout << "Введите число: ";
std::cin >> N;
while (N > 0) {
if (N % 10 == 1)
_counter++;
N /= 10;
}
std::cout << "Количество единиц: " << _counter;
return 0;
#include <iostream>
signed main() {
setlocale(LC_ALL, "Rus");
int N, _counter = 0;
std::cout << "Введите число: ";
std::cin >> N;
while (N > 0) {
if (N % 10 == 1)
_counter++;
N /= 10;
}
std::cout << "Количество единиц: " << _counter;
return 0;
}