Untitled

mail@pastecode.io avatar
unknown
c_cpp
7 months ago
511 B
0
Indexable
Never
#include <iostream>
using namespace std;

int main() {
	setlocale(LC_ALL, "Russian");
	int mas[100], i = 0, count1 = 0, count0 = 0, count = 0;
	for (int i = 0; i < 100; i++) {
		cin >> mas[i];
		if (mas[i] == -1) {
			break;
		}
		count++;
	}
	for (int j = 0; j < count; j++) {
		if (mas[j] == 0) {
			count0++;
		}
		if (mas[j] == 1) {
			count1++;
		}
	}
	cout << "Количество единиц: " << count1 << endl;
	cout << "Количество нулей: " << count0 << endl;
}
Leave a Comment