include iostream using namespace std int main int arr for int sizeof a

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>
using namespace std;
int main() {
int c, arr[3][5] = {{7, 5, 8, 3, 1}, {9, 4, 2, 9, 1}, {1, 4, 5, 2, 1}};
for (int i = 0; i < sizeof(arr)/sizeof(arr[0]); i++) {
for (int j = 0; j < sizeof(arr[0])/sizeof(arr[0][0]); j++) {
cout << arr[i][j] << "\t";
}
cout << "\n" <<endl;
}
for (int i = 0; i < sizeof(arr)/sizeof(arr[0]); i++) {
for (int j = 0; j < sizeof(arr[0])/sizeof(arr[0][0]); j++) {
if (arr[i][j-1] > arr[i][j] && arr[i][j] > arr[i][j+1]) c++;
}
}
cout << c <<endl;
return 0;
}