Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program Project1;
- {$APPTYPE CONSOLE}
- {$R *.res}
- uses
- System.SysUtils;
- var
- Arr: array of integer;
- numOfEl, i, res, min, max: integer;
- begin
- Writeln('Введите количество карточек: ');
- Readln(numOfEl);
- setlength(arr, numOfEl);
- for i := 0 to numOfEl - 1 do
- begin
- Write('Введите номер на карточке: ');
- Readln(Arr[i]);
- end;
- min := arr[0];
- max := arr[0];
- for i := 1 to High(arr) do
- begin
- if arr[i] > Max then
- max := arr[i]
- else if arr[i] < Min then
- min := arr[i];
- end;
- res := max - min;
- Writeln('Максимальное число конфет: ', res);
- Readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement