-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCusto_de_combustivel_string.lpr
54 lines (48 loc) · 1.59 KB
/
Custo_de_combustivel_string.lpr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
program Custo_de_combustivel_string;
uses crt;
var
pd, dnome, cmodelo : string;
totalkm, custopd, totalcustopd, distancia :real;
begin
totalcustopd := 0;
writeln('== ESSE PROGRAMA SOLICITA QUE VOCE COLOQUE O CUSTO DO LITRO ');
writeln('DA GASOLINA OU DIESEL E A DISTANCIA QUE VOCE VIAJA ');
writeln('COM SEU CARRO TODAS AS SEMANAS. ENTAO O COMPUTADOR CALCULA O CUSTO TOTAL');
writeln('QUE VOCE GASTA POR SEMANA COM COMBUSTIVEL. ==');
writeln;
writeln('Aperte qualquer tecla para continuar');
readln;
writeln('');
writeln('========================================================================');
writeln('');
write('Etanol ou gasolina?: ');
readln(pd);
writeln;
write('Nome do motorista: ');
readln(dnome);
writeln;
write('Modelo do carro: ');
readln(cmodelo);
writeln;
write('Valor do Etanol/Gasolina: R$ ');
readln(custopd);
writeln;
write('A quantidade que voce viaja toda semana (em km): ');
readln(distancia);
writeln;
writeln;
writeln('Nome do motorista: ', dnome);
writeln('Modelo do carro: ', cmodelo);
writeln('Etanol/Gasolina: ', pd);
writeln('Quantidade de distancia percorrida toda semana: ', Distancia:0:2,'Km');
writeln('Custo de ', pd, ' por litro: R$', custopd:0:2,' /litro');
writeln;
writeln;
totalcustopd := distancia * custopd;
writeln('Total de custo de ', pd ,' por semana: ',distancia, 'R$', (totalcustopd):0:2);
totalcustopd := 0;
writeln('Total de custo de ', pd ,' por semana: ', 'R$', (distancia*custopd):0:2);
writeln('Total de custo de ', pd ,' por semana: ', 'R$', distancia*custopd);
readln;
readkey;
end.