Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uses crt;
- const f = 5;
- var a:array[1..f] of real; i,x,n:integer; max, min:real;
- begin
- for i:=1 to f do begin
- read(a[i]);
- end;
- max:=a[1];
- min:=a[1];
- x:=1; n:=1;
- for i:=1 to f do begin
- if (a[i] > max) then begin x:=i; max:=a[i]; end
- else if (a[i]<min) then begin n:=i; min:=a[i]; end;
- end;
- a[x]:=min;
- a[n]:=max;
- for i:=1 to f do
- write(a[i],' ');
- writeln();
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement