4 бита
каждый принимает по 2 значения
значит всего вариантов 2*2*2*2 = 16
<em>// PascalABC.NET 3.2, сборка 1345 от 24.11.2016</em>
<em>// Внимание! Если программа не работает, обновите её версию!</em>
begin
var a:=ArrRandom(30,-30,30); a.Println;
Sort(a); a.Println
end.
<u>Пример</u>
-19 19 19 -18 13 -19 -3 13 7 -11 7 0 -12 -21 8 9 -30 27 -18 18 -28 25 -19 -12 -26 -23 1 -15 -4 -9
-30 -28 -26 -23 -21 -19 -19 -19 -18 -18 -15 -12 -12 -11 -9 -4 -3 0 1 7 7 8 9 13 13 18 19 19 25 27
#include <iostream>
#include <ctime>
int main()
{
using namespace std;
const int SIZE = 25;
int massive[SIZE];
//1й пункт
cout << "Enter number: ";
int num;
cin >> num;
int s = 0;
for (int i = 1; i <= num; i++)
if (num % i == 0)
if (i % 2 == 1)
s = s + i;
cout << "The sum of the odd divisors: " << s << endl;
//2й пункт
for (int i = 0; i < SIZE; i++)
{
cout << "Enter #" << i + 1 << " element: ";
cin >> massive[i];
}
for (int i = 0; i < SIZE; i++)
if (massive[i] < 0)
{
massive[i] = 0;
break;
}
for (int i = 0; i < SIZE; i++)
cout << massive[i] << ' ';
//3й пункт
for (int i = 0; i < SIZE; i++)
massive[i] = i + 1;
for (int i = 0; i < SIZE; i++)
if (massive[i] % 3 == 0)
massive[i] *= massive[2];
cout << endl;
for (int i = 0; i < SIZE; i++)
cout << massive[i] << ' ';
//4й пункт
srand(time(0));
for (int i = 0; i < SIZE; i++)
massive[i] = rand();
cout << endl;
for (int i = 0; i < SIZE; i++)
cout << massive[i] << ' ';
cout << endl;
cout << "Enter number: ";
int num2;
cin >> num2;
bool ifsum = false;
for (int i = 0; i < SIZE - 1; i++)
if (massive[i] + massive[i + 1] == num2)
{
ifsum = true;
break;
}
if (ifsum)
cout << "yes";
else
cout << "no";
cout << endl;
return 0;
}
Думаю,что ответ 2))))))))))))))))))))))))))))))))))))))))