Untitled

 avatar
unknown
c_cpp
2 years ago
529 B
2
Indexable
#include <iostream>
using namespace std;
int main()
{
    int mass[100];
    int i = 0;
    int n;
    cin >> n;
    while (n != -1)
    {
        mass[i] = n;
        i++;
        cin >> n;
    }
    int count1 = 0, count2 = 0;
    for (int c = 0; c < i; c++)
    {
        if (mass[c] == 0)
        {
            count1++;
        }
        else
            if (mass[c] == 1)
            {
                count2++;
            }
    }
    cout << count1 << ' ' << count2 << endl;

    return 0;
}
Editor is loading...
Leave a Comment