The consumer cost of a new car is the sum of the factory cost with the dealer percentage and the taxes, both applied to the factory cost. It is known that the percentages are the same as those in the following table. Make a program that takes the cost of the car factory and shows the cost to the consumer.
Custo de Fábrica % do Distribuidor % dos impostos
Até R$ 12.000,00 5 Isento
Entre R$ 12.000,00 10 15
Acima de R$ 25.000,00 15 20
My code:
algoritmo "Preço"
custo_fab, perc_dist, val_dist, perc_imp, val_imp, preco: real
inicio
escreva("Informe o Custo de fábrica: ")
leia(custo_fab)
se (custo_fab < 12000) entao
perc_dist <- 5
perc_imp <- 0
senao
se (custo_fab < 25000) entao
perc_dist <- 10
perc_imp <- 15
senao
perc_dist <- 15
perc_imp <- 20
fimse
fimse
val_dist <- custo_fab * perc_dist / 100
val_imp <- custo_fab * perc_imp / 100
preco <- custo_fab + val_dist + val_imp
escreval("Preço ao consumidor: ", preco)
fimalgoritmo