
СРОЧНО СРОЧНО СРОЧНО ПОЖАЛУЙСТА ПОМОГИТЕ вводится десятичное число. написать программу, которая
вычесляет количество десятков и единиц в вводимом числе. Программа должна вывести на экран сообщение: "в числе десятков= , в числе единиц= ".

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

begin
write('n = ');
readln(n);
writeln('в числе десятков = ',n mod 100 div 10);
writeln('в числе единиц = ', n mod 10);
end.
Пример:
n = 125
в числе десятков = 2
в числе единиц = 5



Program to Calculate the Number of Tens and Units in a Decimal Number
Here is a program in Python that calculates the number of tens and units in a decimal number:
```python decimal_number = float(input("Enter a decimal number: ")) tens = int(decimal_number // 10) units = int(decimal_number % 10) print("Number of tens =", tens) print("Number of units =", units) ```
Explanation: 1. The program prompts the user to enter a decimal number using the `input()` function. 2. The input is converted to a float using the `float()` function to handle decimal numbers. 3. The number of tens is calculated by dividing the decimal number by 10 using the `//` operator, which performs integer division. 4. The number of units is calculated by taking the remainder of the decimal number divided by 10 using the `%` operator. 5. The results are printed using the `print()` function.
Please note that this program assumes the input is a decimal number. If the input is an integer, the program will still work, but the number of tens will be 0.
I hope this helps! Let me know if you have any further questions.


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