Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.
Bài 3:
Program HOC24;
const fi='Nhapvao.txt';
var f: text;
begin
assign(f,fi);
reset(f);
close(f);
end.
Bài 2:
Program HOC24;
const fo='CaDao.txt';
var f: text;
begin
assign(f,fo);
rewrite(f);
writeln(f,'Cong cha nhu nui thai son');
writeln(f,'Nghia me nhu nuoc trong nguon chay ra.');
writeln(f,'Mot long tho me kinh cha');
write(f,'Cho tron chu hieu moi la dao con');
close(f);
end.
const fi='data.txt';
fo='ketqua.txt';
var f1,f2:text;
a,b,h:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,a,b,h);
writeln(f2,0.5*h*(a+b):4:2);
close(f1);
close(f2);
end.
uses crt;
const fi='baitap.txt';
var f1:text;
a,b:integer;
begin
clrscr;
assign(f1,fi); reset(f1);
readln(f1,a,b);
writeln('Chu vi la: ',(a+b)*2);
writeln('Dien tich la: ',a*b);
close(f1);
readln;
end.
uses crt;
const fi='baitap.txt';
var f1:text;
a,b:integer;
begin
clrscr;
assign(f1,fi); reset(f1);
readln(f1,a,b);
writeln('Chu vi hinh chu nhat la: ',(a+b)*2);
close(f1);
readln;
end.
Bài 1:
uses crt;
var a,b:real;
{----------------------------chuong-trinh-con-tinh-chu-vi-------------------------}
function chuvi(x,y:real):real;
begin
chuvi:=(x+y)*2;
end;
{----------------------------chuong-trinh-con-tinh-dien-tich----------------------}
function dientich(m,n:real):real;
begin
dientich:=m*n;
end;
{-----------------------------chuong-trinh-chinh--------------------------}
begin
clrscr;
repeat
write('Nhap chieu dai:'); readln(a);
write('Nhap chieu rong:'); readln(b);
until (a>0) and (b>0) and (a>=b);
writeln('Chu vi hinh chu nhat la: ',chuvi(a,b):4:2);
writeln('Dien tich hinh chu nhat la: ',dientich(a,b):4:2);
readln;
end.
Bài 2:
uses crt;
var a,b,c:real;
{----------------------------chuong-trinh-con-tinh-chu-vi-------------------------}
function chuvi(x,y,z:real):real;
begin
chuvi:=x+y+z;
end;
{----------------------------chuong-trinh-con-tinh-dien-tich----------------------}
function dientich(m,n,p:real):real;
var ncv:real;
begin
ncv:=(m+n+p)/2;
dientich:=sqrt(ncv*(ncv-m)*(ncv-n)*(ncv-p));
end;
{-----------------------------chuong-trinh-chinh--------------------------}
begin
clrscr;
repeat
write('Nhap canh thu 1:'); readln(a);
write('Nhap canh thu 2:'); readln(b);
write('Nhap canh thu 3:'); readln(c);
until (a>0) and (b>0) and (c>0) and (a+b>c) and (a+c>b) and (b+c>a);
writeln('Chu vi hinh tam giac la: ',chuvi(a,b,c):4:2);
writeln('Dien tich hinh tam giac la: ',dientich(a,b,c):4:2);
readln;
end.
Bài 3:
uses crt;
var r:real;
{----------------------------chuong-trinh-con-tinh-chu-vi-------------------------}
function chuvi(x:real):real;
begin
chuvi:=2*x*pi;
end;
{----------------------------chuong-trinh-con-tinh-dien-tich----------------------}
function dientich(m:real):real;
begin
dientich:=sqr(m)*pi;
end;
{-----------------------------chuong-trinh-chinh--------------------------}
begin
clrscr;
repeat
write('Nhap ban kinh:'); readln(r);
until r>0;
writeln('Chu vi hinh tron la: ',chuvi(r):4:2);
writeln('Dien tich hinh tron la: ',dientich(r):4:2);
readln;
end.
Bài 4:
uses crt;
var a,b:real;
{--------------------chuong-trinh-con-tinh-tong------------------------}
function tong(x,y:real):real;
begin
tong:=x+y;
end;
{--------------------chuong-trinh-con-tinh-hieu------------------------}
function hieu(m,n:real):real;
begin
hieu:=m-n;
end;
{--------------------chuong-trinh-con-tinh-tich------------------------}
function tich(c,d:real):real;
begin
tich:=c*d;
end;
{--------------------chuong-trinh-con-tinh-thuong-----------------------}
function thuong(p,q:real):real;
begin
thuong:=p/q;
end;
{--------------------chuong-trinh-chinh--------------------------------}
begin
clrscr;
write('Nhap a='); readln(a);
write('Nhap b='); readln(b);
writeln('Tong cua hai so la: ',tong(a,b):4:2);
writeln('Hieu cua hai so la: ',hieu(a,b):4:2);
writeln('Tich cua hai so la: ',tich(a,b):4:2);
if b<>0 then writeln('Thuong cua hai so la: ',thuong(a,b):4:2)
else writeln('Khong tinh duoc thuong cua hai so vi so chia bang 0');
readln;
end.
uses crt;
const fi='dulieu.dat';
var f1:text;
a,b,p,s:array[1..100]of real;
i,n:integer;
begin
clrscr;
assign(f1,fi); reset(f1);
n:=0;
while not eof(f1) do
begin
n:=n+1;
readln(a[n],b[n]);
end;
for i:=1 to n do
begin
p[i]:=(a[i]+b[i])/2;
s[i]:=a[i]*b[i];
end;
for i:=1 to n do
writeln(p[i]:4:2,' ',s[i]:4:2);
close(f1);
readln;
end.
Program HOC24;
const fi='Data.txt';
fo='Result.txt';
var f: text;
a,b: integer;
dt,cv: longint;
dc: real;
procedure ip;
begin
assign(f,fi);
reset(f);
readln(f,a);
readln(f,b);
close(f);
end;
procedure out;
begin
assign(f,fo);
rewrite(f);
dt:=a*b;
cv:=(a+b)*2;
dc:=sqrt((a*a)+(b*b));
writeln(f,'Chu vi hinh chu nhat la : ',cv);
writeln(f,'Dien tich cua hinh chu nhat la : ',dt);
write(f,'Chieu dai cua duong cheo la : ',dc:1:2);
close(f);
end;
begin
ip;
out;
end.