var a: array[1..100] of real; i, n, j, count: integer; sum: real;
begin {ввод массива} if handsfree then n := random(20) + 5 else begin write('n = '); readln(n); end;
writeln('Данные массива:'); for i := 1 to n do begin if handsfree then begin a[i] := (random(10) - 5) * 0.5; write(a[i], ' '); end else readln(a[i]); end; writeln();
{подсчет суммы и кол-ва} sum := 0; count := 0; for i := 1 to n do begin if a[i] < 0 then sum := sum + a[i]; if a[i] = 0.5 then count := count + 1; end; writeln('count = ', count); writeln('sum = ', sum); end.
0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota
Оформи подписку