Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var
- A, B: array of real;
- i, n, count: integer;
- max: real;
- begin
- write('Введите размер массива A: ');
- readln(n);
- count := 0;
- max := -1;
- SetLength(A, n);
- for i := 0 to n - 1 do
- begin
- write('Введите A[', i, ']: ');
- readln(A[i]);
- if (A[i] > 0) then
- count += 1;
- end;
- SetLength(B, count);
- count := 0;
- for i := 0 to n - 1 do
- begin
- if (A[i] > 0) then
- begin
- B[count] := A[i];
- count += 1;
- if (A[i] > max) then
- max := A[i];
- end;
- end;
- write('Массив B: ');
- for i := 0 to count - 1 do
- write(B[i], ' ');
- writeln();
- write('Наибольший элемент массива B: ', max);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement