Вопрос задан 27.07.2023 в 00:06. Предмет Информатика. Спрашивает Сухин Влад.

Var x,y,z:integer Begin; Read (x); Read (y); If x>y then write (x,'-',y,'=',z) Else write

(y,'-',x,'=',z) End. Я записываю числа 30 20 компьютер решает как 30-20=0 Подскажите как сделать так чтоб z находило а не писало 0.
0 0
Перейти к ответам

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

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Аксёнова Анастасия.
If x>y then write (x,'-',y,'=',x-y)
Else write (y,'-',x,'=',y-x)
0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

To calculate the value of z instead of just displaying it as 0, you need to perform the subtraction operation and assign the result to the variable z. In the provided pseudo-code, the variable z is not being assigned any value after the subtraction. Here's the corrected version of the code:

pascal
Var x, y, z: integer Begin Read(x); Read(y); If x > y then z := x - y Else z := y - x; Write('z = ', z); End.

In this corrected version, the code first reads the values of x and y. Then, it checks whether x is greater than y. If it is, it subtracts y from x and stores the result in z. If x is not greater than y, it subtracts x from y and stores the result in z. Finally, the code displays the value of z.

With this change, if you input 30 for x and 20 for y, the program will output:

makefile
z = 10

This indicates that the result of 30 - 20 is 10.

0 0

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

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

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

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