giải bài tập pascal giúp mik vs
tính giá tiền taxi từ số km đã đi đc nhập vào biết
1km đầu giá 5000 đ
từ km t2-t5 4500đ/km
từ km t6 trở lên 3500đ đi hơn 120km sẽ đc giảm 10% trên tổng giá tiền theo quy định
giải bài tập pascal giúp mik vs
tính giá tiền taxi từ số km đã đi đc nhập vào biết
1km đầu giá 5000 đ
từ km t2-t5 4500đ/km
từ km t6 trở lên 3500đ đi hơn 120km sẽ đc giảm 10% trên tổng giá tiền theo quy định
Program Tien_Taxi;
uses crt;
var km,t:longint;
t1:real;
begin;
clrscr;
writeln(‘nhap so km’);readln(km);
if (km>0) and (km<=1) then t:=km*5000;
if (km>=2) and (km<=5) then t:=1*5000+(km-1)*4500;
if (km>=6) then t:=1*5000+4*4500+(km-5)*3500;
if (km>120) then t1:=t-t*(10/100);
if (km>0) and (km<=120) then writeln('so tien phai tra la ',t,' dong');
if (km>120) then writeln(‘so tien phai tra la ‘,t1:10:2,’ dong’);
readln
end.
Program BTT;
Uses crt;
Var tt,km: extended;
Begin
Clrscr;
Write(‘Nhap so km di duoc: ‘); Readln(km);
If km<=0 then Write(‘So km khong phu hop’);
If km=1 then tt:=5000;
If (km<=5) and (km>=2) then tt:=5000+(km-1)*4500;
If km>=6 then
Begin
tt:=5000+4*4500+(km-5)*3500;
If km>120 then tt:=tt-tt*0.1;
End;
Write(‘So tien phai tra la: ‘,tt:0:2);
Readln;
End.