fork download
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int n,m;
  5. scanf("%d %d", &n, &m);
  6. int array[n][m];
  7.  
  8. for(int i=0; i<n; i++){
  9. for(int j=0; j<m; j++){
  10. scanf("%d", &array[i][j]);
  11. }
  12. }
  13. int value, count = 0;
  14. printf("Enter value of count: ");
  15. scanf("%d", &value);
  16. for(int i=0; i<n; i++){
  17. for(int j=0; j<m; j++){
  18. if(array[i][j] == value){
  19. count++;
  20. }
  21. }
  22. }
  23. printf("Count: %d\n", count);
  24. }
  25.  
  26.  
Success #stdin #stdout 0.01s 5272KB
stdin
3 3
1 1 1
2 3 4
5 6 7

1
stdout
Enter value of count: Count: 3