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.
a)
PROGRAM BAI1a;
VAR N, Tle, Tchan: integer;
BEGIN
Write ('Nhap N =');
Readln (N);
If (N mod 2) = 0 Then
Tle := N*((N - 2)/2 + 1)/2;
Tchan := (N + 2)*((N - 2)/2 + 1)/2;
If (N mod 2) = 1 Then
Tle := (N + 1)*((N-1)/2 +1)/2;
Tchan := (N + 1)*((N - 3)/2 + 1)/2;
WRITELN ('Sle =', Sle, 'Schan =', Schan);
READLN;
END.
const fi='songuyen.inp';
fo='tong.out';
var f1,f2:text;
a:array[1..100]of integer;
i,n,t:integer;
begin
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;
t:=0;
for i:=1 to n do
if a[i] mod 2=0 then t:=t+a[i];
writeln(f2,t);
close(f1);
close(f2);
end.
uses crt;
const fo='b.txt';
var f1:text;
a:array[1..200]of integer;
i,n:integer;
begin
clrscr;
assign(f1,fo); rewrite(f2);
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
for i:=1 to n do
write(f1,a[i]:4);
close(f1);
readln;
end.
program cap_so_cong;
uses crt; var a: array[1..100] of integer; i, n, k: integer;
{i la bien dem, k de luu cap so} begin clrscr; write('N= ');
readln(n); for i:=1 to n do begin write('A(',i,')= ');
readln(a[i]);
end;
{Bat dau phan kiem tra} k:=a[2]-a[1]; i:=2; repeat i:= i+1; until (a[i]<>a[i-1]+k) or (i>n);
if i>n then write('Day A la mot cap so cong') else
write('Day A khong phai la mot cap so cong');
readln
end.
Program HOC24;
var i,n: integer;
a: array[1..1000] of integer;
t: longint;
f1,f2: text;
const fi='DATA1.TXT';
fo='KQ1.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]);
t:=0;
for i:=1 to n do if a[i] mod 2=0 then t:=t+a[i];
writeln(f2,t);
for i:=1 to n do if a[i] mod 5=0 then write(f2,a[i],' ');
close(f1); close(f2);
end.
const fi='input.txt';
fo='output.txt';
var f1,f2:text;
a:array[1..100]of integer;
i,n,t:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
n:=0;
while not eof(f1) do
begin
inc(n);
read(f1,a[n]);
end;
t:=0;
for i:=1 to n do t:=t+a[i];
write(f2,t);
close(f1);
close(f2);
end.