Câu 1:
uses crt;
var s,i,m:integer;
begin
clrscr;
write('m='); readln(m);
s:=0;
i:=1;
while s<=m do
begin
s:=s+i;
i:=i+1;
end;
writeln(s);
readln;
end.
Câu 2:
uses crt;
var s,i,m:integer;
begin
clrscr;
write('m='); readln(m);
s:=0;
i:=1;
while s<=m do
begin
s:=s+i;
i:=i+1;
end;
writeln(s-i);
readln;
end.
Câu 3:
uses crt;
var s,i,m:integer;
begin
clrscr;
write('m='); readln(m);
s:=0;
i:=3;
while s<=m do
begin
s:=s+i;
i:=i+4;
end;
writeln(s);
readln;
end.
Câu 4:
uses crt;
var s,i,m:integer;
begin
clrscr;
write('m='); readln(m);
s:=0;
i:=3;
while s<=m do
begin
s:=s+i;
i:=i+4;
end;
writeln(s-i);
readln;
end.
Câu 5:
uses crt;
var s,i,m:integer;
begin
clrscr;
write('m='); readln(m);
s:=0;
i:=5;
while s<=m do
begin
s:=s+i;
i:=i+6;
end;
writeln(s);
readln;
end.
Câu 6:
uses crt;
var s,i,m:integer;
begin
clrscr;
write('m='); readln(m);
s:=0;
i:=5;
while s<=m do
begin
s:=s+i;
i:=i+6;
end;
writeln(s-i);
readln;
end.
Câu 7:
uses crt;
var s,i,m:integer;
begin
clrscr;
write('m='); readln(m);
s:=0;
i:=1;
while s<=m do
begin
s:=s+i;
i:=i+1;
end;
writeln(i);
readln;
end.
Câu 8:
uses crt;
var s,i,m:integer;
begin
clrscr;
write('m='); readln(m);
s:=0;
i:=3;
while s<=m do
begin
s:=s+i;
i:=i+4;
end;
writeln(i);
readln;
end.
Câu 9:
uses crt;
var s,i,m:integer;
begin
clrscr;
write('m='); readln(m);
s:=0;
i:=5;
while s<=m do
begin
s:=s+i;
i:=i+6;
end;
writeln(i);
readln;
end.
Câu 10:
uses crt;
var i,n,dem:integer;
begin
clrscr;
write('Nhap n='); readln(n);
i:=1;
dem:=0;
while i<=n do
begin
if n mod i=0 then inc(dem);
i:=i+1;
end;
if dem=2 then writeln(n,' la so nguyen to')
else writeln(n,' khong la so nguyen to');
readln;
end.