Вопрос задан 16.06.2023 в 10:47. Предмет Информатика. Спрашивает Ликсман Алёнка.

ДАЮ 100 БАЛЛОВ! ИНФОРМАТИКА! ОЧЕНЬ СРОЧНО НУЖНА ПОМОЩЬ! Заданы числа а и b. Написать программу,

которая определит, эти числа одного или разных знаков (положительные/отрицательные) Задание нужно решить в программе Паскаль!!! ​
0 0
Перейти к ответам

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

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

Ответ:

// PascalABC.NET 3.1, сборка 1239 от 08.05.2016

begin

 var a,b:real;

 Write('Введите два числа через пробел: ');

 Read(a,b);

 if a*b>0 then Writeln('Числа одного знака')

 else Writeln('Числа разных знаков')

end.

Объяснение:

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

Program to Determine the Signs of Numbers

To write a program in Pascal that determines whether two given numbers, `a` and `b`, have the same or different signs (positive/negative), you can use the following code:

```pascal program DetermineSigns; var a, b: integer; begin writeln('Enter the value of a: '); readln(a); writeln('Enter the value of b: '); readln(b); if (a > 0) and (b > 0) then writeln('Both numbers are positive.') else if (a < 0) and (b < 0) then writeln('Both numbers are negative.') else writeln('The numbers have different signs.'); end. ```

This program prompts the user to enter the values of `a` and `b`. It then checks the conditions using `if` statements to determine whether both numbers are positive, both are negative, or they have different signs. The program then outputs the corresponding message.

Please note that this program assumes the input numbers are integers. If you need to handle decimal numbers, you can modify the program accordingly.

I hope this helps! Let me know if you have any further questions.

0 0

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

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

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

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