1. Trang chủ
  2. » Giáo án - Bài giảng

minh ths80yahoo minh ths80yahoo com vn program bt1 type record bg sl dt real end var a array1 100 of bg nid integer tbctb real begin write‘nhap so xa’ readlnn write‘nhap san luo

2 3 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 2
Dung lượng 4,8 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Trang 1

Program bt1;

Type

Record = Bg

Sl, DT:real;

end;

Var

a:array[1 100] of Bg;

n,i,d:integer; Tbc,tb:real;

Begin

write(‘Nhap so xa’); readln(n);

write(‘Nhap san luong va dien tich cac xa’); tbc:=0;

For i:=1 to n do

begin

write(‘nhap san luong cua xa thu ‘,i,’: ‘); readln(a[i].sl),

write(‘Nhap dien tich cua xa thu ‘,’i: ‘); readln(a[i].dt);

tbc:=tbc + a[i].sl;

end;

tbc :=tbc / n;

d:=0;

tb:=0;

for i:=1 to n do

if a[i].sl > tbc then

begin

d:=d+1;

tb:=tb+a[i].sl;

end;

write(‘So luong xa co NS cao hon:’,d);

write(‘Tbinh nhung xa co NS cao hon:’,tb/d :1:2); readln;

end

program bt2;

type

record = bg

sp:integer;

tdt,tt:real;

end;

var

a:array[1 10] of bg;

tg:bg;

n,i,j:integer; g:real;

begin

write(‘nhap n = ‘); readln(n);

for i:=1 to n do

begin

writeln(‘Nhap thong tin cho can ho thu ‘,i,’:’); write(‘Nhap so phong:’,); readln(a[i].sp);

write(‘Nhap dien tich:’); readln(a[i].dt);

write(‘Nhap gia :’); readln(a[i].gia);

end;

(*sap xep*)

for i:=1 to n do

for j:=i+1 to n do

if a[i].sp>a[i].sp then

begin

Trang 2

tg:=a[i];

a[i]:=a[j];

a[j]:=tg;

end;

writeln(‘So thu tu So phong Dien tich Gia ban’); for i:=1 to n do

writeln,’ ‘,a[i].sp,’ ‘,a[i].dt,’ ‘, a[i].gia);

tdt:=0; tt:=0;

for i:=1 to n do

begin

tdt:=tdt+a[i].dt;

if a[i].dt<100 then

tt:=tt+a[i].gia

else if a[i].dt<150 then

tt:=tt+a[i].gia-a[i].gia*0.1

else tt:=tt+ a[i].gia-a[i].gia*0.15;

end;

writeln(‘tong dien tich:’,tdt’,’tong tien: ‘,tt);

end;

Ngày đăng: 11/04/2021, 14:01

TÀI LIỆU CÙNG NGƯỜI DÙNG

  • Đang cập nhật ...

🧩 Sản phẩm bạn có thể quan tâm

w