Вопрос задан 16.06.2023 в 02:50. Предмет Информатика. Спрашивает Таныгин Никита.

9. Составьте программы в Python. 1) Найдите произведение цифр четырехзначного числа. 2) Найдите

сумму второй, третьей и четвертой цифр пятизначного числа
0 0
Перейти к ответам

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

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

1) a = int(input())

b = a % 10

c = a % 100 // 10

d = a // 100 % 10

e = a // 1000

print(b * c * d * e)

2) a = int(input())

b = a % 100 // 10

c = a // 100 % 10

d = a // 1000 % 10

print(b + c + d)

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

I can help you with writing Python programs. Here are some possible solutions for your tasks:

1) To find the product of the digits of a four-digit number, you can use the following code:

```python # Input a four-digit number as a string number = input("Enter a four-digit number: ")

# Initialize the product as 1 product = 1

# Loop through each digit and multiply it with the product for digit in number: product = product * int(digit)

# Print the product print("The product of the digits is", product) ```

2) To find the sum of the second, third and fourth digits of a five-digit number, you can use the following code:

```python # Input a five-digit number as a string number = input("Enter a five-digit number: ")

# Extract the second, third and fourth digits using slicing digits = number[1:4]

# Initialize the sum as 0 sum = 0

# Loop through each digit and add it to the sum for digit in digits: sum = sum + int(digit)

# Print the sum print("The sum of the second, third and fourth digits is", sum) ```

I hope this helps. If you have any other questions, feel free to ask me.

0 0

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

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

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

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