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.
uses crt;
const fi='dulieu.dat';
var f1:text;
a,b,p,s:array[1..100]of real;
i,n:integer;
begin
clrscr;
assign(f1,fi); reset(f1);
n:=0;
while not eof(f1) do
begin
n:=n+1;
readln(a[n],b[n]);
end;
for i:=1 to n do
begin
p[i]:=(a[i]+b[i])/2;
s[i]:=a[i]*b[i];
end;
for i:=1 to n do
writeln(p[i]:4:2,' ',s[i]:4:2);
close(f1);
readln;
end.
uses crt;
const fi='so.inp';
var f1:text;
a,b:integer;
begin
clrscr;
assign(f1,fi); reset(f1);
while not eof(f1) do
begin
readln(f1,a,b);
writeln((a+b)/2:4:2);
end;
close(f1);
readln;
end.
uses crt;
const fi='dayso.txt';
fa='tong.txt';
fb='kq.txt';
var f1,f2,f3:text;
a:array[1..100]of integer;
n,i,t,kt,j:integer;
begin
clrscr;
assign(f1,fi); reset(f1);
assign(f2,fa); rewrite(f2);
assign(f3,fb); rewrite(f3);
n:=0;
while not eof(f1) do
begin
n:=n+1;
readln(f1,a[n]);
end;
{--------------------------cau-a--------------------------}
t:=0;
for i:=1 to n do
t:=t+a[i];
writeln(f2,'tong cua day so la: ',t);
{--------------------------cau-b--------------------------}
writeln(f3,'cac so chan trong day la: ');
for i:=1 to n do
if a[i] mod 2=0 then write(f3,a[i]:4);
writeln(f3);
writeln(f3,'cac so le trong day la: ');
for i:=1 to n do
if a[i] mod 2<>0 then write(f3,a[i]:4);
{--------------------------cau-c--------------------------}
writeln('cac so nguyen to trong day la: ');
for i:=1 to n do
if a[i]>1 then
begin
kt:=0;
for j:=2 to a[i]-1 do
if a[i] mod j=0 then kt:=1;
if kt=0 then write(a[i]:4);
end;
close(f1);
close(f2);
close(f3);
readln;
end.
uses crt;
const fi='dulieu.txt';
var f1:text;
a,b:array[1..100]of integer;
i,n:integer;
begin
clrscr;
assign(f1,fi); reset(f1);
n:=0;
while not eof(f1) do
begin
inc(n);
readln(f1,a[n],b[n]);
end;
for i:=1 to n do
begin
if a[i]<b[i] then writeln(a[i])
else writeln(b[i]);
end;
readln;
end.
const fi='input.inp';
fo='output.out';
var a,b:integer;
f1,f2:text;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,a,b);
if a<b then writeln(f2,a)
else writeln(f2,b);
close(f1);
close(f2);
end.
Câu 1:
uses crt;
const fi='dl.doc';
fo='tb.doc';
var f1,f2:text;
a,b:integer;
tbc:real;
begin
clrscr;
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,a);
readln(f1,b);
{-----------------------------------cau-a-----------------------------}
writeln('a=',a);
writeln('b=',b);
{-----------------------------------cau-b-----------------------------}
tbc:=(a+b)/2;
writeln(f2,tbc:4:2);
close(f1);
close(f2);
readln;
end.