#1
var
A : array [1..21] of integer;
min : integer := 32766;
begin
for var i:=1 to 21 do
readln(A[i]);
if (A[i] < min) then
min := A[i];
writeln(min);
end.
#2
Y : array [1..25] of integer;
isthefirst : boolean := false;
last : integer := 0;
for var i:=1 to 25 do
readln(Y[i]);
if (Y[i] < 0) and (isthefirst = false) then
writeln(i);
isthefirst := true;
break;
end;
for var i:=2 to 25 do
if (i = 25) then
if (Y[i] < 0) and (last = 0) then
last := i;
if ((Y[i+1] > 0) and (Y[i] < 0)) then
if (isthefirst) and (last = 0) then
last := 1;
if (last <> 0) then
writeln(last) else
writeln('There''no numbers');
//Не бейте за кастыли Мне лень думать)))000
type TIntMassiv = array of Integer; //Дин. Массив (Более гибок в работе)
n : integer;
sum : integer := 0;
counter : integer := 0;
var A: TIntMassiv;
readln (n);
SetLength(A, n);
for var i:=0 to n-1 do
if (A[i] > 0) and (A[i] mod 2 = 0) then
sum += A[i];
counter += 1;
if (sum = 0) or (counter = 0) then
writeln('There''re no numbers');
exit;
writeln(sum/counter);
#include <conio.h>
#include <time.h>
using namespace std;
void main()
{
srand(time(NULL));
setlocale(0, "");
int arr[17];
int a, b, chet=0, nechet = 0;
cout << "Введите диапазон ." << endl << "Нижняя граница диапазона: "; cin >> a; cout << "Верхняя граница диапазона: "; cin >> b; cout << endl;
for (int i = 0; i < 17; ++i)
{
arr[i] = a + rand() % (b-a+1);
cout <<" "<<arr[i];
}
for (int i = 0; i < 17; ++i)
{
if (arr[i] % 2 == 0) chet++;
else nechet++;
} if (chet > nechet)
cout << " \n Четных больше";
else if (nechet>chet)
cout << "\n Нечетных больше";
else cout << "\n Одинаковое количество четных и нечетных";
_getch();
}
#1
var
A : array [1..21] of integer;
min : integer := 32766;
begin
for var i:=1 to 21 do
readln(A[i]);
for var i:=1 to 21 do
if (A[i] < min) then
min := A[i];
writeln(min);
end.
#2
var
Y : array [1..25] of integer;
isthefirst : boolean := false;
last : integer := 0;
begin
for var i:=1 to 25 do
readln(Y[i]);
for var i:=1 to 25 do
if (Y[i] < 0) and (isthefirst = false) then
begin
writeln(i);
isthefirst := true;
break;
end;
for var i:=2 to 25 do
begin
if (i = 25) then
begin
if (Y[i] < 0) and (last = 0) then
last := i;
break;
end;
if ((Y[i+1] > 0) and (Y[i] < 0)) then
last := i;
end;
if (isthefirst) and (last = 0) then
last := 1;
if (last <> 0) then
writeln(last) else
writeln('There''no numbers');
end.
//Не бейте за кастыли Мне лень думать)))000
#2
type TIntMassiv = array of Integer; //Дин. Массив (Более гибок в работе)
var
n : integer;
sum : integer := 0;
counter : integer := 0;
var A: TIntMassiv;
begin
readln (n);
SetLength(A, n);
for var i:=0 to n-1 do
begin
readln(A[i]);
if (A[i] > 0) and (A[i] mod 2 = 0) then
begin
sum += A[i];
counter += 1;
end;
end;
if (sum = 0) or (counter = 0) then
begin
writeln('There''re no numbers');
exit;
end;
writeln(sum/counter);
end.