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 2 0

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

THÔNG TIN TÀI LIỆU

info@123doc.org 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 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 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 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 for j:=i+1 to n if a[i].sp>a[i].sp then begin tg:=a[i]; a[i]:=a[j]; a[j]:=tg; end; writeln(‘So thu tu So phong for i:=1 to n writeln,’ ‘,a[i].sp,’ ‘,a[i].dt,’ tdt:=0; tt:=0; for i:=1 to n begin tdt:=tdt+a[i].dt; if a[i].dt

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

Xem thêm:

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

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