int main() { int n; std::cout << "Enter the size of the array: "; std::cin >> n;
int arr[n]; std::cout << "Enter the elements of the array: "; for(int i = 0; i < n; i++) { std::cin >> arr[i]; } int b; std::cout << "Enter the number 'b': "; std::cin >> b; int sum = 0; for(int i = 0; i < n; i++) { if(arr[i] > b) { sum += arr[i]; } } std::cout << "Sum of elements in the array greater than " << b << ": " << sum << std::endl; return 0;
int main() {
int arr[n];int n;
std::cout << "Enter the size of the array: ";
std::cin >> n;
std::cout << "Enter the elements of the array: ";
for(int i = 0; i < n; i++) {
std::cin >> arr[i];
}
int b;
std::cout << "Enter the number 'b': ";
std::cin >> b;
int sum = 0;
for(int i = 0; i < n; i++) {
if(arr[i] > b) {
sum += arr[i];
}
}
std::cout << "Sum of elements in the array greater than " << b << ": " << sum << std::endl;
return 0;
}