Есть ответ 👍

Информатика 7 класс семакин, залогова, русаков кнспект 7-8 парагравы

162
245
Посмотреть ответы 1

Ответы на вопрос:


#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; }

Популярно: Информатика