Вопрос задан 13.07.2023 в 11:59. Предмет Информатика. Спрашивает Черноусова Арина.

Задача 3 program n n;var x,y: integer;beginх: =7;y: = 3;if (y div x) >0 then x:=x+y mod 3else

y:=y div 3+2*xwriteln(y);end.Задача 4program n n;var x,y: integer;beginx:=4;y:=3;if (x div y) <>0 then if x<>y then x:=x div 4+x mod 8 else x:= x mod yelse x:=y mod 4+x*2writeln (x) end. ​
0 0
Перейти к ответам

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

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Шандренко Денис.

Ответ:

В задаче 3 - 15

В задаче 4 - 5

0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

To solve these problems, let's analyze each program step by step and determine the final output.

Задача 3:

pascal
program n n; var x, y: integer; begin x := 7; y := 3; if (y div x) > 0 then x := x + y mod 3 else y := y div 3 + 2 * x; writeln(y); end.

Explanation:

  1. x is initialized to 7 and y is initialized to 3.
  2. The condition (y div x) > 0 is (3 div 7) > 0, which evaluates to 0 > 0 (false), so we move to the else part.
  3. In the else part, y is assigned the value 3 div 3 + 2 * 7, which simplifies to 1 + 14 = 15.
  4. The writeln(y) statement outputs the value of y, which is 15.

Output for Задача 3: 15


Задача 4:

pascal
program n n; var x, y: integer; begin x := 4; y := 3; if (x div y) <> 0 then if x <> y then x := x div 4 + x mod 8 else x := x mod y else x := y mod 4 + x * 2; writeln(x); end.

Explanation:

  1. x is initialized to 4, and y is initialized to 3.
  2. The condition (x div y) <> 0 is (4 div 3) <> 0, which evaluates to 1 <> 0 (true). So, we move to the inner if-else.
  3. The condition x <> y is 4 <> 3 (true), so we go to the if part.
  4. In the if part, x is assigned the value 4 div 4 + 4 mod 8, which simplifies to 1 + 4 = 5.

Output for Задача 4: 5

If you run both programs, you should get the outputs mentioned above.

0 0

Похожие вопросы

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

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

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