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.
![](https://rs.olm.vn/images/avt/0.png?1311)
uses crt;
var a,b:integer;
{-----------------chuong-trinh-con-tinh-chu-vi----------------------------------}
function cv(x,y:integer):integer;
begin
cv:=x+y;
end;
{-------------------chuong-trinh-con-tinh-dien-tich-----------------------------}
function dt(x,y:integer):integer;
begin
dt:=x*y;
end;
{-------------------------chuong-trinh-chinh-------------------------}
begin
clrscr;
write('Nhap chieu dai:'); readln(a);
write('Nhap chieu rong:'); readln(b);
writeln('Chu vi la: ',cv(a,b));
writeln('Dien tich la: ',dt(a,b));
readln;
end.
![](https://rs.olm.vn/images/avt/0.png?1311)
Uses crt;
Const fi='input.txt';
Fo='output.txt';
Var f1,f2:text;
A,b:array[1..100] of integer;
I,n:integer;
Begin
Clrscr;
Assign(f1,fi); reset(f1);
Assign(f2,fo); rewrite(f2);
N:=0;
While not eof(f1) do
Begin
Inc(n);
Readln(f1,a[n],b[n]);
End;
For i:=1 to n do
Begin
Writeln('Chu vi hinh chu nhat thu ',i,' la: ',(a[i]+b[i])*2);
Writeln(f2,Chu vi hinh chu nhat thu ',i,' la: ',(a[i]+b[i])*2);
End;
Close(f1);
Close(f2);
Readln;
End.
![](https://rs.olm.vn/images/avt/0.png?1311)
Uses crt;
Var dai,rong:integer;
Procedure Nhap(Var dai:integer;rong:integer);
Begin
Write('Chieu dai: ');readln(dai);
Write('Chieu rong: ');readln(rong);
End;
Procedure Ve(var dai:integer;rong:integer);
var i,j:integer;
Begin
for i:= 1 to dai do write('*');writeln;
For i:= 1 to rong-2 do
Begin
Write('*');
for j:=1 to dai-2 do write(' ');
writeln('*');
end;
for i:= 1 to dai do write('*');
End;
Begin
clrscr;
Nhap(dai,rong);
Ve(dai,rong);
readln;
End.
![](https://rs.olm.vn/images/avt/0.png?1311)
Tham khảo
program hcn;
uses crt;
var d,r,dt:longint;
cv:real;
begin
write('nhap chieu dai va chieu rong cua hcn:');
readln(d,r);
cv:=(d+r)*2;
dt:=d*r;
writeln(' chu vi hcn do la:',cv);
writeln(' dien tich hcn do la:',dt);
readln
end.
![](https://rs.olm.vn/images/avt/0.png?1311)
uses crt;
const fi='hcn.dat';
fo='chuvi.out';
var f1,f2:text;
a,b:array[1..100]of integer;
n,i,j:integer;
begin
clrscr;
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
n:=0;
while not eof(f1) do
begin
n:=n+1;
readln(f1,a[n],b[n]);
end;
for i:=1 to n do
writeln(a[i]*b[i]);
for i:=1 to n do
writeln(f2,2*(a[i]+b[i]));
close(f1);
close(f2);
readln;
end.
![](https://rs.olm.vn/images/avt/0.png?1311)
Bài 5:
#include <bits/stdc++.h>
using namespace std;
long long a,b;
int main()
{
cin>>a>>b;
cout<<(a+b)*2;
return 0;
}
![](https://rs.olm.vn/images/avt/0.png?1311)
const fi='bt1.inp';
fo='bt1.out';
var f1,f2:text;
a,b:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,a,b);
writeln(f2,'Chu vi la: ',(a+b)*2);
writeln(f2,'Dien tich la: ',a*b);
close(f1);
close(f2);
end.
#include <bits/stdc++.h>
using namespace std;
long long s,cv,a,b;
int main()
{
cin>>s>>cv;
cv=cv/2;
for (a=1; a<=cv/2; a++)
for (b=cv/2+1; b<=cv; b++)
if ((a*b==s) and (a+b==cv))
{
cout<<b<<" "<<a;
return 0;
}
return 0;
}
anh có thể viết bằng pascal đc k ạ