python converter to c 1

python converter to c

 float(input("Digite quantos litros você quer abastecer: "))
 input("Digite A para álcool ou G para gasolina: ")

if combustivel == "A" or combustivel == "a":
    preco = litros * 1.9
    if litros <= 20:
        preco -= 1.9 * litros * 3 / 100
    else:
        preco -= 1.9 * litros * 5 / 100
elif combustivel == "G" or combustivel == "g":
    preco = litros * 2.5
    if litros <= 20:
        preco -= 2.5 * litros * 4 / 100
    else:
        preco -= 2.5 * litros * 6 / 100
print(f"O preço a pagar é R${preco:.2f}")

Here is what the above code is Doing:
1. It asks the user to input the number of liters they want to fill up.
2. It asks the user to input the type of fuel they want to fill up.
3. It calculates the price of the fuel.
4. It prints the price.

Similar Posts