1.
#include <iostream>
#define N 10
int main()
{
using namespace std;
int count = 0, sum = 0, mult = 1;
int arr[N]{0, 7, 5, 2, -10, -3, 4, 6, 12, -1};
for (const auto i : arr)
if (i < 0)
count++;
sum += i;
mult *= i;
}
cout << "Count = " << count << "\nSum = " << sum
<< "\nMult = " << mult;
return 0;
2.
#define N 3
int arr[N][N]{0, 7, 5, 2, -10, -3, 4, 6, -1};
for (int i = 0; i < N; i++)
for (int j = 0; j < N; j++)
if (arr[i][j] < 0)
sum += arr[i][j];
mult *= arr[i][j];
1.
#include <iostream>
#define N 10
int main()
{
using namespace std;
int count = 0, sum = 0, mult = 1;
int arr[N]{0, 7, 5, 2, -10, -3, 4, 6, 12, -1};
for (const auto i : arr)
{
if (i < 0)
{
count++;
sum += i;
mult *= i;
}
}
cout << "Count = " << count << "\nSum = " << sum
<< "\nMult = " << mult;
return 0;
}
2.
#include <iostream>
#define N 3
int main()
{
using namespace std;
int count = 0, sum = 0, mult = 1;
int arr[N][N]{0, 7, 5, 2, -10, -3, 4, 6, -1};
for (int i = 0; i < N; i++)
{
for (int j = 0; j < N; j++)
{
if (arr[i][j] < 0)
{
count++;
sum += arr[i][j];
mult *= arr[i][j];
}
}
}
cout << "Count = " << count << "\nSum = " << sum
<< "\nMult = " << mult;
return 0;
}