Advertisement
believe_me

Untitled

Dec 19th, 2021
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.75 KB | None | 0 0
  1. program Project1;
  2.  
  3. {$APPTYPE CONSOLE}
  4.  
  5. {$R *.res}
  6.  
  7. uses
  8.   System.SysUtils;
  9.  
  10. var
  11.     Arr: array of integer;
  12.     numOfEl, i, res, min, max: integer;
  13.  
  14. begin
  15.     Writeln('Введите количество карточек: ');
  16.     Readln(numOfEl);
  17.     setlength(arr, numOfEl);
  18.     for i := 0 to numOfEl - 1 do
  19.     begin
  20.         Write('Введите номер на карточке: ');
  21.         Readln(Arr[i]);
  22.     end;
  23.     min := arr[0];
  24.     max := arr[0];
  25.     for i := 1 to High(arr) do
  26.     begin
  27.         if arr[i] > Max then
  28.             max := arr[i]
  29.         else if arr[i] < Min then
  30.             min := arr[i];
  31.     end;
  32.     res := max - min;
  33.     Writeln('Максимальное число конфет: ', res);
  34.     Readln;
  35. end.
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement