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.
const fi='songuyen.txt';
fo='gtln.txt';
var f, g: text;
max, x: longint;
i, j: byte;
begin
assign(f, fi);
reset(f);
assign(g, fo);
rewrite(g);
max:=minlongint;
for i:=1 to 5 do
for j:=1 to 4 do
begin
read(f, x);
if x>max then max:=x;
if j=4 then readln(f);
end;
write(g, max);
close(f);
close(g);
end.
a)
Input: Số nguyên dương N, dãy số a1,a2,a3,...,an
Output: Tổng các số chẵn nhỏ hơn hoặc bằng N
b)
Program HOC24;
var i,n: integer;
t: longint;
a: array[1..1000] of integer;
f1,f2: text;
const fi='SONGUYEN.TXT';
fo='SOCHAN.TXT';
begin
assign(f1,fi);
assign(f2,fo);
reset(f1);
rewrite(f2);
readln(f1,n);
for i:=1 to n do read(f1,a[i]);
for i:=1 to n do if (a[i] mod 2=0) and (a[i]<=n) then
begin
write(f2,a[i],' ');
t:=t+a[i];
end;
writeln(f2);
write(f2,t);
close(f1); close(f2);
end.
uses crt;
const fi='songuyen.txt';
var f1:text;
a:array[1..100]of integer;
i,n,t:integer;
begin
clrscr;
assign(f1,fi); reset(f1);
n:=0;
while not eof(f1) do
begin
inc(n);
read(f1,a[n]);
end;
t:=0;
for i:=1 to n do
if a[i]>0 then t:=t+a[i];
writeln(t);
close(f1);
readln;
end.
const fi='songuyen.txt';
fo='kluan.txt';
var f1,f2:text;
n:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,n);
if n mod 2=0 then writeln(f2,'La so chan')
else writeln(f2,'La so le');
close(f1);
close(f2);
end.
Program HOC24;
const fi='SONGUYEN.TXT';
fo='KETQUA.TXT';
var n,i,d:integer;
a: array[1..32000] of integer;
function nt(x: integer): boolean;
var j: integer;
begin
nt:=true;
if (x=2) or (x=3) then exit;
nt:=false;
if (x=1) or (x mod 2=0) or (x mod 3=0) then exit;
j:=5;
while j<=trunc(sqrt(x)) do
begin
if (x mod j=0) or (x mod (j+2)=0) then exit;
j:=j+6;
end;
nt:=true;
end;
procedure ip;
begin
assign(f,fi);
reset(f);
readln(f,n);
for i:=1 to n do read(f,a[i]);
close(f);
end;
procedure out;
begin
assign(f,fo);
rewrite(f);
d:=0;
for i:=1 to n do
if nt(a[i]) then inc(d);
write(f,d);
close(f);
end;
begin
ip;
out;
end.
uses crt;
const fi='data.txt';
fo='songuyen.txt';
var f1,f2:text;
a:array[1..100]of integer;
m,i,dem,k:integer;
begin
clrscr;
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,m);
for i:=1 to m do
read(f1,a[i]);
for i:=1 to m do
if a[i]>0 then write(f2,a[i]:4);
writeln(f2);
write('Nhap so k='); readln(k);
dem:=0;
for i:=1 to m do
if a[i] mod k=0 then inc(dem);
writeln(f2,'So cac phan tu la boi cua ',k,' la: ',dem);
close(f1);
close(f2);
readln;
end.