Giải giúp mik bài pascal này bt: – 1km đầu là 15000. – Từ km thứ 2 đến km thứ 10 là 14000. – Từ km thứ 11 đến km thứ 20 là 12500. – Từ km thứ 21 đến k

Giải giúp mik bài pascal này bt: – 1km đầu là 15000. – Từ km thứ 2 đến km thứ 10 là 14000. – Từ km thứ 11 đến km thứ 20 là 12500. – Từ km thứ 21 đến km thứ 30 là 11000. – Trên 30km thì mỗi km tăng thêm là 9000. Yêu cầu: Nhập dữ liệu: nhập số km (> 0) Xuất kết quả: In ra màn hình s

0 bình luận về “Giải giúp mik bài pascal này bt: – 1km đầu là 15000. – Từ km thứ 2 đến km thứ 10 là 14000. – Từ km thứ 11 đến km thứ 20 là 12500. – Từ km thứ 21 đến k”

  1. Program BTT;
    Uses crt;
    Var km,tien: qword;
    Begin
            Clrscr;
            Write(‘Nhap km: ‘); Readln(km);
            tien:=15000;
            If (km>1) and (km<11) then tien:=tien+km*14000;
            If (km>10) and (km<21) then tien:=tien+126000+(km-10)*12500;
            If (km>20) and (km<31) then tien:=tien+126000+125000+(km-20)*11000;
            If km>30 then tien:=tien+126000+125000+110000+(km-30)*9000;
            Write(‘Tien phai tra: ‘,tien);
            Readln
    End.

    Bình luận
  2. var i,n,s:lognint;

    begin

    write(‘Nhap so km: ‘); readln(n);

    for i:=1 to n do

    begin

    if (i>1) and (i<11) then s:=s + 14000
    if (i>10) and (i<21) then s:=s+ 12500
    if (i>20) and (i<31) then s:=s+11000;
    if i>30 then s:=s+9000;

    end;

    write(‘So tien la: ‘,s+15000);

    readln;

    end.

    Bình luận

Viết một bình luận