Ответ:
Ничего сложного
Объяснение:
1.
#include <iostream>
using namespace std;
int main() {
setlocale(LC_ALL, "rus");
int that = 1, index = 1, sum_index = 0, sum_element = 0;
while (that != 0) {
cin >> that;
if (that % 2 == 0) sum_element += that;
if (index % 2 == 0) sum_index += that;
index++;
}
cout << "Сумма четных элементов = " << sum_element << endl;
cout << "Сумма элементов с четными индексами = " << sum_index;
}
2.
#include <iostream>
using namespace std;
void cycle_for() {
int sum = 0;
for (int i = 50; i <= 150; i++) if (i % 4 == 0) sum += i * i;
cout << "Cycle for: " << sum << endl;
}
void cycle_while() {
int i = 50, sum = 0;
while (i <= 150) {
if (i % 4 == 0) sum += i * i;
i++;
}
cout << "Cycle while: " << sum << endl;
}
void cycle_do_while() {
int i = 50, sum = 0;
do {
if (i % 4 == 0) sum += i * i;
i++;
} while (i <= 151);
cout << "Cycle do while: " << sum;
}
int main() {
cycle_for();
cycle_while();
cycle_do_while();
}
Var
i,s:integer;
a:array[1..15] of integer;
begin
randomize;
for i:=1 to 15 do
begin a[i]:=random(21);
write(a[i],' ');
if a[i]<=10 then s:=s+a[i]
end;
writeln('Сумма ',s)
<span>end.</span>
Program z1;
var f: array[1..14] of integer;
sum,i:integer;
begin
randomize;
for i:=1 to 14 do
begin
f[i]:=random(16,35);
writeln(f[i],' человек',' в',' ',i,' классе');
Sum:=Sum+f[I];
end;
writeln('----------------------');
writeln ('Всего человек:',sum);
writeln ('Нужно уроков:',14*2); // делим на 2 группы,т.к во всех классах >16 человек.
writeln ('Нужно часов:',(14*2)*0.75); // урок длится 3/4 часа (45 минут).
end.