View Code of Problem 3857

#include <stdio.h>
int main(){
  int t;
  scanf("%d",&t);
  int n,num,i;
  int a[1000];
  while(t--){
    num=0;
    scanf("%d",&n);
    for(i=0;i<n;i++){
      scanf("%d",&a[i]);
    }
    for(i=0;i<n;i++){
      if(a[i]==2)
        num++;
    }
    printf("%d\n",num);
    
    
  }
  
  
  
  
  
  return 0;
}

Double click to view unformatted code.


Back to problem 3857