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';
fo='output.txt';
var f1,f2:text;
a,b:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,a,b);
if (a=0) and (b=0) then writeln(f2,'Phuong trinh co vo so nghiem');
if (a<>0) then writeln(f2,-b/a:4:2);
if (a=0) and (b<>0) then writeln(f2,'Phuong trinh vo nghiem');
close(f1);
close(f2);
end.
const fi='dulieu.txt';
fo='ketqua.txt';
var f1,f2:text;
a,b,c,d:array[1..100]of integer;
i,n,dem,dem1:integer;
begin
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;
dem:=0;
dem1:=0;
for i:=1 to n do
if a[i]>b[i] then
begin
inc(dem);
inc(dem1);
c[dem]:=a[i];
d[dem]:=b[i];
end
else begin
inc(dem);
inc(dem1);
c[dem]:=b[i];
d[dem]:=a[i];
end;
for i:=1 to dem do
write(f2,c[i]:4);
writeln(f2);
for i:=1 to dem1 do
write(f2,d[i]:4);
close(f1);
close(f2);
end.
uses crt;
const fi='bt.txt';
fo='soam.txt';
var f1,f2:text;
a:array[1..100]of integer;
i,n:integer;
begin
clrscr;
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
n:=0;
while not eoln(f1) do
begin
n:=n+1;
read(f1,a[n]);
end;
for i:=1 to n do
begin
if a[i]>0 then writeln('Can bac hai cua ',a[i],' la: ',sqrt(a[i]):4:2)
else if a[i]<0 then write(f2,a[i]:4);
end;
close(f1);
close(f2);
readln;
end.
uses crt;
const fi='dl.txt';
fo='soam.txt';
var f1,f2:text;
a:array[1..100]of integer;
i,n:integer;
begin
clrscr;
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
n:=0;
while not eoln(f1) do
begin
n:=n+1;
read(f1,a[n]);
end;
for i:=1 to n do
begin
if a[i]>0 then writeln('Can bac hai cua ',a[i],' la: ',sqrt(a[i]):4:2)
else if a[i]<0 then write(f2,a[i]:4);
end;
close(f1);
close(f2);
readln;
end.
uses crt;
const fi='dl.txt';
fo='soam.txt';
var f1,f2:text;
a:array[1..100]of integer;
i,n:integer;
begin
clrscr;
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
n:=0;
while not eoln(f1) do
begin
n:=n+1;
read(f1,a[n]);
end;
for i:=1 to n do
begin
if a[i]>0 then writeln('Can bac hai cua ',a[i],' la: ',sqrt(a[i]):4:2)
else if a[i]<0 then write(f2,a[i]:4);
end;
close(f1);
close(f2);
readln;
end.
Câu 1:
const fi1='nguyen1.inp';
fi2='nguyen2.inp';
fo='songuyen.inp';
var f1,f2,f3:text;
a:array[1..10000]of integer;
i,dem:integer;
begin
assign(f1,fi1); reset(f1);
assign(f2,fi2); reset(f2);
assign(f3,fo); rewrite(f3);
dem:=0;
while not eof(f1) do
begin
inc(dem);
read(f1,a[dem]);
end;
while not eof(f2) do
begin
inc(dem);
read(f2,a[dem]);
end;
for i:=1 to dem do
write(f3,a[i]:4);
close(f1);
close(f2);
close(f3);
end.
Câu 2:
uses crt;
const fi='vanban.txt';
var f1:text;
st:array[1..255]of string;
dem:integer;
begin
clrscr;
assign(f1,fi); reset(f1);
dem:=0;
while not eof(f1) do
begin
inc(dem);
readln(f1,st[dem]);
end;
writeln('So dong cua tep ',fi,' la: ',dem);
close(f1);
readln;
end.
Câu 3:
const fi='nguon.txt';
fo='dich.txt';
var f1,f2:text;
st:array[1..255]of string;
i,dem:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
dem:=0;
while not eof(f1) do
begin
inc(dem);
readln(f1,st[dem]);
end;
for i:=1 to dem do
writeln(f2,st[i]:4);
close(f1);
close(f2);
end.
Câu 4:
const fi='dulieu.int';
fo='sochan.out';
var f1,f2:text;
a:array[1..255]of integer;
i,dem:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
dem:=0;
while not eoln(f1)do
begin
inc(dem);
read(f1,a[dem]);
end;
for i:=1 to dem do
if a[i] mod 2=0 then write(f2,a[i]:4);
close(f1);
close(f2);
end.
Câu 5:
const fi='dulieu.int';
fo='dulieu.out';
var f1,f2:text;
a:array[1..255]of integer;
i,n,tam,j:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,n);
for i:=1 to n do
read(f1,a[i]);
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;
for i:=1 to n do
write(f2,a[i]:4);
close(f1);
close(f2);
end.