Программа 1.
program P1;
var a,b,sum, i : Integer;
begin
write('a = '); readln(a);
write('b = '); readln(b);
sum := 0;
for i := a to b do sum := sum + i;
writeln('sum = ', sum);
end.
Программа 2.
program P2;
var arr : array[1..8] of Integer;
i, count,weight : Integer;
randomize;
for i := 1 to 8 do arr[i] := Random(10) + 10;
count := 0; weight := 0;
for i := 1 to 8 do if arr[i] > 15 then begin
count := count + 1; weight := weight + arr[i];
end;
writeln('Общее к-ство ', count);
writeln('Общий вес ', weight);
Программа 1.
program P1;
var a,b,sum, i : Integer;
begin
write('a = '); readln(a);
write('b = '); readln(b);
sum := 0;
for i := a to b do sum := sum + i;
writeln('sum = ', sum);
end.
Программа 2.
program P2;
var arr : array[1..8] of Integer;
i, count,weight : Integer;
begin
randomize;
for i := 1 to 8 do arr[i] := Random(10) + 10;
count := 0; weight := 0;
for i := 1 to 8 do if arr[i] > 15 then begin
count := count + 1; weight := weight + arr[i];
end;
writeln('Общее к-ство ', count);
writeln('Общий вес ', weight);
end.