Ответы на вопрос:
#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; }
Популярно: Информатика
-
AnDrejk423.01.2020 12:45
-
dschunchewa201319.09.2022 06:36
-
182838485829.11.2022 01:14
-
Regina39128.12.2021 17:43
-
dinara24078717.08.2022 15:30
-
linaaaa2Li19.07.2022 17:12
-
putnikputen29.01.2021 21:35
-
София24090508.03.2022 00:17
-
feruza111124.08.2020 23:13
-
zhanelkenesbekova07.07.2021 13:09