Untitled

 avatar
unknown
c_cpp
2 years ago
511 B
2
Indexable
#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;
}
Editor is loading...
Leave a Comment