Вопрос задан 28.04.2019 в 09:27. Предмет Информатика. Спрашивает Шорохов Никита.

For i:=0 to 10 do A[i]:=i*2; for i:= 10 downto 0 do begin k:=A[10-i]; A[10-i]:=A[i]; A[i]:=k; end.

0 0
Перейти к ответам

Ответы на вопрос

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Милаева Лена.
1)
полученные числа:
0 1 2 3 4 5 4 3 2 1 0
2)
 10
 3)
10 9 8 7 6 5 4 3 2 1 0 
 4)
10 9 8 7 6 5 6 7 8 9 10
  5)
полученные числа: 
1 0 3 2 5 4 7 6 9 8 10
0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

The code you provided appears to be written in Pascal programming language. It consists of two loops: the first loop assigns values to an array called A, and the second loop swaps the elements of the array.

Here is a breakdown of the code:

```pascal for i := 0 to 10 do A[i] := i * 2; for i := 10 downto 0 do begin k := A[10 - i]; A[10 - i] := A[i]; A[i] := k; end; ```

In the first loop, the variable `i` iterates from 0 to 10. On each iteration, the value of `i` is multiplied by 2 and assigned to the corresponding element of the array `A`. As a result, the array `A` will contain the values `[0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20]`.

In the second loop, the variable `i` iterates from 10 down to 0. On each iteration, the elements of the array `A` are swapped. The variable `k` is used as a temporary variable to hold the value of `A[10 - i]`. Then, the value of `A[i]` is assigned to `A[10 - i]`, and finally, the value of `k` is assigned to `A[i]`. This loop effectively reverses the order of the elements in the array `A`.

After the execution of both loops, the array `A` will contain the values `[20, 18, 16, 14, 12, 10, 8, 6, 4, 2, 0]`.

Please let me know if you have any further questions!

0 0

Топ вопросов за вчера в категории Информатика

Последние заданные вопросы в категории Информатика

Задать вопрос