Câu 1:
program an_danh;
uses crt;
var i,e,tong:integer;
begin
clrscr;
write('Nhap E: ');readln(e);
i:= 0; tong:= 0;
while tong <= e do
begin
i:= i + 1;
tong:= tong + i;
end;
write('Gia tri nho nhat: ',i);
readln
end.
Bài 1:
uses crt;
var s,i,e:longint;
begin
clrscr;
write('e='); readln(e);
i:=1;
s:=1;
while s<=e do
begin
inc(i);
s:=s+i;
end;
writeln('gia tri nguyen duong nho nhat de tong S=1+2+3+...>',e,' la: ',i);
readln;
end.
Bài 2:
uses crt;
var n,i,d,kt:integer;
st:string;
begin
clrscr;
write('n='); readln(n);
str(n,st);
d:=length(st);
kt:=0;
for i:=1 to d do
if st[i]<>st[d-i+1] then kt:=1;
if kt=0 then writeln(n,' la so doi xung')
else writeln(n,' khong la so doi xung');
readln;
end.