int main() { int n; std::cout << "Enter the size of the array: "; std::cin >> n;
int arr[n]; int sum = 0; int product = 1; std::cout << "Enter the elements of the array: "; for(int i = 0; i < n; i++) { std::cin >> arr[i]; sum += arr[i]; product *= arr[i]; } std::cout << "Sum of the elements: " << sum << std::endl; std::cout << "Product of the elements: " << product << std::endl; return 0;
int main() {
int arr[n];int n;
std::cout << "Enter the size of the array: ";
std::cin >> n;
int sum = 0;
int product = 1;
std::cout << "Enter the elements of the array: ";
for(int i = 0; i < n; i++) {
std::cin >> arr[i];
sum += arr[i];
product *= arr[i];
}
std::cout << "Sum of the elements: " << sum << std::endl;
std::cout << "Product of the elements: " << product << std::endl;
return 0;
}