#include <iostream>
using namespace std;
int main()
{
#define B_LENGTH 10
// Variables
int b[B_LENGTH] = { 0 };
int bSum = 0;
// Input data
cout << "Input " << B_LENGTH << " numbers in your array." << endl;
cout << "Important condition, your number can be more then 1, but less then 7" << endl;
for (int i = 0; i < B_LENGTH; i++) {
while (b[i] <= 1 || b[i] >= 7) {
cout << "B[" << i << "] = ";
cin >> b[i];
}
// Output data
cout << "Good. Your array is:" << endl;
bSum += b[i];
cout << b[i] << " ";
cout << endl << "Sum of the array elements is " << bSum << endl;
return 0;
#include <iostream>
using namespace std;
int main()
{
#define B_LENGTH 10
// Variables
int b[B_LENGTH] = { 0 };
int bSum = 0;
// Input data
cout << "Input " << B_LENGTH << " numbers in your array." << endl;
cout << "Important condition, your number can be more then 1, but less then 7" << endl;
for (int i = 0; i < B_LENGTH; i++) {
while (b[i] <= 1 || b[i] >= 7) {
cout << "B[" << i << "] = ";
cin >> b[i];
}
}
// Output data
cout << "Good. Your array is:" << endl;
for (int i = 0; i < B_LENGTH; i++) {
bSum += b[i];
cout << b[i] << " ";
}
cout << endl << "Sum of the array elements is " << bSum << endl;
return 0;
}