
Напишите программу которая выводит с клавиатуры два целых числа - цену 1 л бензина и объём бака
автомобиля и выводит на экран цену заправки полного бака. Оформите ввод и вывод так, как в примере: Сколько стоит 1л бензина? 40 Объём бака? 50 Заправка стоит 2000 руб. На питоне

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

Ответ:
print("Сколько стоит 1л бензина?")
price_per_liter = int(input())
print("Объём бака?")
tank_volume = int(input())
total_price = price_per_liter * tank_volume
print(f"Заправка стоит {total_price}



volume = int(input("Объём бака? "))
cost = price * volume
print("Заправка стоит", cost, "грн.")



Sure! Here's a Python program that prompts the user to enter the price of 1 liter of gasoline and the capacity of the car's fuel tank. It then calculates and displays the cost of filling up the entire tank.
pythonprice_per_liter = int(input("Сколько стоит 1л бензина? "))
tank_capacity = int(input("Объём бака? "))
total_cost = price_per_liter * tank_capacity
print("Заправка стоит", total_cost, "руб.")
In this program, we use the input()
function to receive user input for the price per liter and the tank capacity. The int()
function is used to convert the input into integers for mathematical calculations. We then multiply the price per liter by the tank capacity to obtain the total cost. Finally, we use the print()
function to display the result on the screen.


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