View Code of Problem 3857

#include<iostream>
using namespace std;
int main()
{
	int t;
	cin >> t;
	while(t --)
	{
		int n;
		cin >> n;
		int cnt = 0;
		while(n --)
		{
			int a;
			cin >> a
			if(a==2) cnt ++;
		}
		cout << cnt << endl;
	}
	return 0;
}
/*
Main.cc: In function 'int main()':
Main.cc:15:12: error: expected ';' before 'if'
    cin >> a
            ^
            ;
    if(a==2) cnt ++;
    ~~       
*/

Double click to view unformatted code.


Back to problem 3857