#include <iostream>
#include <ctime>
using namespace std;
#define n 15
int main()
{
int s = 0;
int a[n];
srand((unsigned)time(NULL));
cout << "Array: ";
for (int i = 0; i < n; i++)
a[i] = (rand() % 251) - 150;
cout << a[i] << " ";
if ((a[i] % 2 != 0) && (a[i] % 3 == 0))
s += a[i];
}
cout << endl << s << endl;
return 0;
#include <iostream>
#include <ctime>
using namespace std;
#define n 15
int main()
{
int s = 0;
int a[n];
srand((unsigned)time(NULL));
cout << "Array: ";
for (int i = 0; i < n; i++)
{
a[i] = (rand() % 251) - 150;
cout << a[i] << " ";
if ((a[i] % 2 != 0) && (a[i] % 3 == 0))
s += a[i];
}
cout << endl << s << endl;
return 0;
}