
Информатика:Даны два целых числа, каждое записано в отдельной строке. Программа должна вывести
число 1, если первое число больше второго, число 2, если второе больше первого, или число 0, если они равны.

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

if a> b then write ('1') else write ('2');
if a=b then write ('0');
end.



Problem Statement
You are given two integers, each written on a separate line. Your program should output the number 1 if the first number is greater than the second number, the number 2 if the second number is greater than the first number, or the number 0 if they are equal.Solution
To solve this problem, you can follow these steps:1. Read the first integer from the input. 2. Read the second integer from the input. 3. Compare the two integers using an if-else statement. 4. If the first integer is greater than the second integer, output the number 1. 5. If the second integer is greater than the first integer, output the number 2. 6. If the two integers are equal, output the number 0.
Here's an example implementation in Python:
```python # Read the first integer num1 = int(input())
# Read the second integer num2 = int(input())
# Compare the two integers if num1 > num2: print(1) elif num2 > num1: print(2) else: print(0) ```
This program reads two integers from the input and compares them using an if-else statement. The appropriate number is then printed based on the comparison.
Let's consider an example: - Input: ``` 5 10 ``` - Output: ``` 2 ``` In this example, the second number (10) is greater than the first number (5), so the program outputs 2.
I hope this helps! Let me know if you have any further questions.


Топ вопросов за вчера в категории Другие предметы
Последние заданные вопросы в категории Другие предметы
-
Математика
-
Литература
-
Алгебра
-
Русский язык
-
Геометрия
-
Английский язык
-
Химия
-
Физика
-
Биология
-
Другие предметы
-
История
-
Обществознание
-
Окружающий мир
-
География
-
Українська мова
-
Информатика
-
Українська література
-
Қазақ тiлi
-
Экономика
-
Музыка
-
Право
-
Беларуская мова
-
Французский язык
-
Немецкий язык
-
МХК
-
ОБЖ
-
Психология
-
Физкультура и спорт
-
Астрономия
-
Кыргыз тили
-
Оʻzbek tili