Skip to content

Instantly share code, notes, and snippets.

@vertrigo
Created October 10, 2012 14:41
Show Gist options
  • Select an option

  • Save vertrigo/3866055 to your computer and use it in GitHub Desktop.

Select an option

Save vertrigo/3866055 to your computer and use it in GitHub Desktop.
Program lab4;
uses Crt;
type mas = array[1..10] of integer;
var a:mas; i, count, scount, sum:integer;
Begin
ClrScr;
writeln('Введите массив из 10 элементов: ');
for i:=1 to 10 do
read(a[i]);
sum:= 0; count:=0; scount:=0;
for i:=1 to 10 do
if (a[i] mod 2 = 0) then count:=count+1;
writeln('Количество четных элементов: ',count:3);
if count > 5 then begin
for i:=1 to 10 do if (a[i] > 0) then scount:=scount+1;
writeln('Количество положительных элементов: ',scount:3);
end else begin
for i:=1 to 10 do if (a[i] mod 2 <> 0) then sum:=sum+a[i];
writeln('Сумма нечетных элементов: ',sum:3);
end;
Readkey;
End.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment