Var a:array[1..1000] of longint; n, i, k: longint; begin k:=0 readln(n); for i:=1 to n do begin readln(a[i]); if (i mod 2 = 0) and (a[i] mod 2 = 1) then k:=k+1; end; writeln(k); end.
gallush9
24.12.2021
Const n = 10; var a: array[1..n] of integer; i, j, t: integer; flag:boolean;
begin Randomize; Writeln('Исходный массив'); for i := 1 to n do begin a[i] := random(101)-50; Write(a[i]:4) end; Writeln; i:=1; repeat flag:=true; for j := 1 to n-i do if a[j] > a[j+1] then begin t := a[j]; a[j] := a[j+1]; a[j+1] := t; flag:=false end; Inc(i); until (i>n-1) or flag; Writeln('Отсортированный по возрастанию массив'); for i := 1 to n do Write(a[i]:4); Writeln end.
Const n = 10; var a: array[1..n] of integer; i, j, t: integer; flag:boolean;
begin Randomize; Writeln('Исходный массив'); for i := 1 to n do begin a[i] := random(101)-50; Write(a[i]:4) end; Writeln; i:=1; repeat flag:=true; for j := 1 to n-i do if a[j] > a[j+1] then begin t := a[j]; a[j] := a[j+1]; a[j+1] := t; flag:=false end; Inc(i); until (i>n-1) or flag; Writeln('Отсортированный по возрастанию массив'); for i := 1 to n do Write(a[i]:4); Writeln end.
n, i, k: longint;
begin
k:=0
readln(n);
for i:=1 to n do begin
readln(a[i]);
if (i mod 2 = 0) and (a[i] mod 2 = 1) then k:=k+1;
end;
writeln(k);
end.