-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththe22arr.cpp
More file actions
41 lines (35 loc) · 962 Bytes
/
Copy paththe22arr.cpp
File metadata and controls
41 lines (35 loc) · 962 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include<iostream>
using namespace std ;
int indexofnum(int *arr,int n){
cout<< "arr[]=";
for (int i=0;i<n;i++){
cout<<arr[i]<<",";}
int index=7;
cout << "index = " <<index<<endl ;
for (int i=0;i<n;i++){
if (arr[i]==index){
return i ;
// }
}
}
return -1;
// cout << "false "<< endl;
}
int matrix12(int mat[][3],int n ,int m,int indx){
int sum=0;
for (int i=0;i<n;i++){
for (int j=0;j<m;j++){
if (mat[i][j]==indx){
sum++;
}
}
}
return sum;
}
int main(){
int mat[][3]={{7,5,7},{7,0,7}};
int n = 2;
int m = 3;
cout << matrix12(mat,n,m,7)<<endl;
return 0;
}