Var a: array [1..1000] of integer; n, i, max, min, amount:integer; begin read(n); for i := 1 to n do read(a[i]); max := a[1]; min := a[1]; amount := 0; for i := 1 to n do begin if a[i] > max then max := a[i]; if a[i] < min then min := a[i]; if (i mod 2 = 0) and (a[i] < 0) then amount := amount + 1; end; writeln('Sum of min and max equals ',max + min); writeln('Amount of numbers below zero and on even places: ', amount); for i := 1 to n do if i mod 2 = 0 then write(a[i], ' '); end.
Var n, amount, max_digit, copy_of_n: integer; begin read(n); copy_of_n := n; amount := 0; max_digit := copy_of_n mod 10; while copy_of_n <> 0 do begin {Находим наибольшую цифру в числе} if max_digit < copy_of_n mod 10 then max_digit := copy_of_n mod 10; copy_of_n := copy_of_n div 10; end; copy_of_n := n; while copy_of_n <> 0 do {Считаем количество таких цифр} begin if copy_of_n mod 10 = max_digit then amount := amount + 1; copy_of_n := copy_of_n div 10; end; writeln(amount); end.
begin
read(n);
for i := 1 to n do
read(a[i]);
max := a[1];
min := a[1];
amount := 0;
for i := 1 to n do
begin
if a[i] > max
then
max := a[i];
if a[i] < min
then
min := a[i];
if (i mod 2 = 0) and (a[i] < 0)
then
amount := amount + 1;
end;
writeln('Sum of min and max equals ',max + min);
writeln('Amount of numbers below zero and on even places: ', amount);
for i := 1 to n do
if i mod 2 = 0
then
write(a[i], ' ');
end.
begin
read(n);
copy_of_n := n;
amount := 0;
max_digit := copy_of_n mod 10;
while copy_of_n <> 0 do
begin {Находим наибольшую цифру в числе}
if max_digit < copy_of_n mod 10
then
max_digit := copy_of_n mod 10;
copy_of_n := copy_of_n div 10;
end;
copy_of_n := n;
while copy_of_n <> 0 do {Считаем количество таких цифр}
begin
if copy_of_n mod 10 = max_digit
then
amount := amount + 1;
copy_of_n := copy_of_n div 10;
end;
writeln(amount);
end.