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.
with open('DULIEU.INP', 'r') as input_file:
p, q = map(int, input_file.readline().strip().split())
chu_vi = 2 * (p + q)
dien_tich = p * q
with open('KETQUA.OUT', 'w') as output_file:
output_file.write(f'Chu vi hinh chu nhat la: {chu_vi}\n')
output_file.write(f'Dien tich hinh chu nhat la: {dien_tich}\n')
uses crt;
const fi='dlra.txt';
var a:array[1..100]of integer;
i,n,h:integer;
f1:text;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
assign(f1,fi); rewrite(f1);
h:=0;
for i:=1 to n do
if a[i] mod 2=0 then
begin
write(f1,a[i]:4);
h:=h+a[i];
end;
writeln(f1);
writeln(f1,h);
close(f1);
readln;
end.
uses crt;
const fi='kiemtra.txt';
var f1:text;
a:array[1..100]of integer;
min,n,i:integer;
{----------------chuong-trinh-con-------------------}
function nn(x,y:integer):integer;
begin
if x<y then nn:=x
else nn:=y;
end;
{-----------------chuong-trinh-chinh-----------------}
begin
clrscr;
write('nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
min:=nn(a[1],a[2]);
for i:=3 to n do
if min>a[i] then min:=a[i];
writeln(min);
readln;
end.
Mình xin sửa lại một chút:
uses crt;
const fi='kiemtra.txt';
var f1:text;
a:array[1..100]of integer;
min,n,i:integer;
{----------------chuong-trinh-con-------------------}
function nn(x,y:integer):integer;
begin
if x<y then nn:=x
else nn:=y;
end;
{-----------------chuong-trinh-chinh-----------------}
begin
clrscr;
assign(f1,fi); reset(f1);
readln(f1,n);
for i:=1 to n do
read(f1,a[i]);
min:=nn(a[1],a[2]);
for i:=3 to n do
if min>a[i] then min:=a[i];
writeln(min);
readln;
end.
uses crt;
const fi='kiemtra.txt';
var f1:text;
a,b,c:integer;
begin
clrscr;
assign(f1,fi); reset(f1);
readln(f1,a);
readln(f1,b);
readln(f1,c);
writeln((a+b)*(a+c)*(c+b));
close(f1);
readln;
end.
uses crt;
const fi='kiemtra.txt';
var f1:text;
a,b,c:integer;
begin
clrscr;
assign(f1,fi); reset(f1);
readln(f1,a,b,c);
writeln((a+b)*(a+c)*(b+c));
close(f1);
readln;
end.
Python:
n=int(input("Nhap so nguyen duong n:"))
dem=0
for i in range(1,n+1):
if i%4==0:
dem=dem+1
print(dem)