Предмет: Информатика, автор: teieoriru8

Дан массив из N элементов. Поменять местами первый наибольший элемент с последним наименьшим. Например исходный массив 10, 9, 10,5,5.
Результат работы 5, 9, 10, 5,10.​​

Ответы

Автор ответа: Puz1koO
2

var

 n,max,min,i:integer;

 a:array of integer;

begin

 readln(n);

 setlength(a,n);

 max:=0; min:=0;

 for i:=0 to n-1 do

   begin

     readln(a[i]);

     if a[i]>a[max] then

       max:=i

         else

           if a[i]<=a[min] then

             min:=i;

   end;

 i:=a[max];

 a[max]:=a[min];

 a[min]:=i;

 

 for i:=0 to n-1 do

   write(a[i]:4);

end.

Похожие вопросы
Предмет: Русский язык, автор: Аноним
Предмет: Окружающий мир, автор: 89127101595
Предмет: Английский язык, автор: MUSOLALKA
Прочитайте текст, выполните задания к тексту.

Ответьте в виде текста, указав номер предложения и выбранную букву (например, 1-a, 2-b, 3-c)

Charlie Chaplin was a famous English actor. He was born in England on 16th of April 1889. His parents were artists of Music Hall. His first step to the stage was at the age of 5. He attended school very seldom. He had to work because his family was very poor. He worked as a newspaperman and the assistant of a doctor. At the age of 16 he played violin a lot 4-16 hours a day. At the age of 19 he began working at the theatre. Charlie worked in silent comedy films and became famous all over the world because of his talent. His nickname was "The Little Tramp”. He had a black moustache, small black hat and a stick. He was funny, small, talented and clever. He liked making people laugh most of all. Chaplin won Oscar twice. His most famous films are "Big City Lights” and "The Great Dictator”.


"Charlie Chaplin”.

Make the test! (find the right answer)


1.Name

a) Diana Spencer b) Charlie Chaplin c) Elton John

2. He was famous English....

a) singer b) scientist c) actor

3....was born in ...

a) in England b) in Great Britain c) in the USA

4. His parents were ....

a) politicians b) writers c) artists

5. His first step to the stage was at the age of ... .

a) 5 b) 6 c) 7

6. He was famous for ....

a) his books b) his films and talent c) his songs

7. He was ...(=traits of character)

a) funny and talented b) stupid c) non-athletic