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.
uses crt;
const fi='input.txt';
var f1:text;
a:array[1..100]of integer;
n,i,max:integer;
begin
clrscr;
assign(f1,fi); rewrite(f1);
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
max:=a[1];
for i:=1 to n do
if max<a[i] then max:=a[i];
writeln(f1,max);
close(f1);
readln;
end.
uses crt;
var a:array[1..100]of real;
i,n,j:integer;
tam:real;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
for i:=1 to n-1 do
for j:=i+1 to n do
if a[i]>a[j] then
begin
tam:=a[i];
a[i]:=a[j];
a[j]:=tam;
end;
writeln('Day tang dan la: ');
for i:=1 to n do
write(a[i]:4:2,' ');
writeln;
writeln('Day giam dan la: ');
for i:=n downto 1 do
write(a[i]:4:2,' ');
readln;
end.
uses crt;
var x,dt,s:real;
i:integer;
{---------------chuong-trinh-con-nhap--------------------------}
procedure nhap(a:real);
begin
write('Nhap ban kinh:'); readln(a);
end;
{--------------------chuong-trinh-con-tinh-dien-tich-----------------------------}
function dtht(a:real):real;
begin
dtht:=sqr(a)*pi;
end;
{-----------------------chuong-trinh-chinh-----------------------------}
begin
clrscr;
s:=0;
for i:=1 to 5 do
begin
nhap(x);
dt:=dtht(x);
s:=s+dt;
end;
writeln(s:4:2);
readln;
end.
Bạn thử xem đúng không nha!!!
var n,i,k:longint;
f:text;
A:array[1..100000] of longint; {Bạn thay longint bằng những kiểu số nguyên khắc cũng được nhé}
begin
assign(f, 'Vd1.INP');
reset(f);
readln(f,n);
for i:=1 to n do readln(f, A[i]);
close(f);
assign(f, 'Vd2.OUT');
rewrite(f);
for k:=1 to n do if (k mod 2= 0) then
begin write(f, k); write(f, ' '); end;
close(f);
end.
Program HOC24;
var i,n: integer;
a: array[1..32000] of integer;
t: longint;
begin
write('Nhap N: '); readln(n);
t:=0;
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
if a[i] mod 3=0 then t:=t+a[i];
end;
write('Tong cac phan tu chia het cho 3 la: ',t);
readln
end.
uses crt;
var a:array[1..100]of integer;
n,i,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to n do
if a[i] mod 3=0 then t:=t+a[i];
writeln(t);
readln;
end.
uses crt;
const fi='bai.inp';
var f1:text;
m,n:real;
begin
clrscr;
assign(f1,fi); rewrite(f1);
write('m='); readln(m);
writeln(f1,'m=',m:4:2);
write('n='); readln(n);
writeln(f1,'n=',n:4:2);
writeln(f1,m:4:2,'+',n:4:2,'=',m+n:4:2);
close(f1);
readln;
end.
Program HOC24;
var a: array[1..50] of integer;
i,j,n,k,d,tg: integer;
t: longint;
begin
write('N='); readln(n);
t:=0;
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
if a[i]>0 then t:=t+a[i];
end;
write('K='); readln(k);
write('Cac phan tu chan la : ');
for i:=1 to n do if a[i] mod 2=0 then write(a[i],' ');
writeln;
writeln('Tong cac phan tu duong la : ',t);
d:=0;
for i:=1 to n do if a[i]=k then d:=d+1;
writeln('Trong mang co ',d,' phan tu bang ',k);
write('Mang sau khi sap xep la : ');
for i:=1 to n do
for j:=i to n do
if a[i]>a[j] then
begin
tg:=a[i];
a[i]:=a[j];
a[j]:=tg;
end;
for i:=1 to n do write(a[i],' ');
readln
end.
uses crt;
var a:array[1..50]of integer;
n,i,dem,tbc:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
writeln('Cac so chan la: ');
dem:=0;
tbc:=0;
for i:=1 to n do
if a[i] mod 2=0 then
begin
write(a[i]:4);
inc(dem);
tbc:=tbc+a[i];
end;
writeln;
writeln('So phan tu chan la: ',dem);
writeln('Trung binh cong cua cac so chan trong day la: ',tbc/dem:4:2);
readln;
end.
uses crt;
var a:array[1..300]of integer;
i,n,dem,kt,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
dem:=0;
for i:=1 to n do
if a[i] mod 3=0 then inc(dem);
t:=abs(a[2]-a[1]);
kt:=0;
for i:=1 to n do
if t<>abs(a[i]-a[i-1]) then
begin
kt:=1;
break;
end;
if kt=0 then writeln('Day la cap so cong')
else writeln('Day khong la cap so cong');
readln;
end.