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.
Đúng 2
Bình luận (0)
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.
Đúng 1
Bình luận (0)