int main() { int n; cout << "Enter the size of the square array: "; cin >> n;
int arr[n][n]; int count = 0; cout << "Enter elements of the array:" << endl; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { cin >> arr[i][j]; if (arr[i][j] % 3 == 0) { count++; } } } cout << "Number of elements divisible by 3 in the array: " << count; return 0;
using namespace std;
int main() {
int arr[n][n];int n;
cout << "Enter the size of the square array: ";
cin >> n;
int count = 0;
cout << "Enter elements of the array:" << endl;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cin >> arr[i][j];
if (arr[i][j] % 3 == 0) {
count++;
}
}
}
cout << "Number of elements divisible by 3 in the array: " << count;
return 0;
}