exercise in visualg algorithm [closed]
closed . This question needs details or to be clearer and is not currently accepting answers.
Want to improve this question? Add details and make it clearer what problem is being solved by editing this post .
Closed 3 years ago .
improve this questionThe consumer cost of a new car is the sum of the factory cost with the percentage of the distributor and with taxes, both applied to the cost of factory. It is known that the percentages are the same as in the following table. Make a program that receives the car factory cost 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
1