fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int a[] = {0, 5, 5, 5, 4};
  6. int n = 7;
  7. int x = 2;
  8. int count = 0;
  9.  
  10. for(int i = 0; i < n; i++) {
  11. if(a[i] == x) count++;
  12. }
  13.  
  14. cout << count << endl;
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
0