![](https://rs.olm.vn/images/avt/0.png?1311)
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.
![](https://rs.olm.vn/images/avt/0.png?1311)
![](https://rs.olm.vn/images/avt/0.png?1311)
lệnh for...to...do:
a)program tinh_tong;
uses crt;
var i,s:byte;
begin
clrscr;
s:=0;
for i:=1 to 9 do s:=s+i;
write(s);
readln;
end.
b)
program tinh_tong;
uses crt;
var i,s:byte;
begin
clrscr;
s:=0;
for i:=1 to 14 do
begin
if i mod 2=0 then
s:=s+i;
end;
write(s);
readln;
end.
c)
program tinh_tong;
uses crt;
var i,s:byte;
begin
clrscr;
s:=0;
for i:=1 to 15 do
begin
if i mod 2=1 then
s:=s+i;
end;
write(s);
readln;
end.
lệnh while...do
a)program tinh_tong;
uses crt;
var i,s:byte;
begin
clrscr;
s:=0;
i:=1;
while i<=9 do
begin
s:=s+i;
i:=i+1;
end;
write(s);
readln;
end.
b)program tinh_tong;
uses crt;
var i,s:byte;
begin
clrscr;
s:=0;
i:=1;
while i<=14 do
begin
if i mod 2=0 then
s:=s+i
else i:=i+1;
end;
write(s);
readln;
end.
c)
program tinh_tong;
uses crt;
var i,s:byte;
begin
clrscr;
s:=0;
i:=1;
while i<=15 do
begin
if i mod 2=1 then
s:=s+i
else i:=i+1;
end;
write(s);
readln;
end.
![](https://rs.olm.vn/images/avt/0.png?1311)
program tong_so;
var
tong, so: integer;
begin
tong := 0;
while tong < 20 do
begin
write('Nhập số nguyên: ');
readln(so);
tong := tong + so;
end;
writeln('Tổng các số đã nhập là: ', tong);
end.
![](https://rs.olm.vn/images/avt/0.png?1311)
Var s1,s2,i,j:integer;
Begin
s1:=1;
s2:=0;
i:=2;
j:=4;
While i<=50 do
Begin
s1:=s1+i;
i:=i+2;
End;
While j<=20 do
Begin
s2:=s2+j;
j:=j+4;
End;
s2:=s2+32;
Writeln('Tong day N = ',s1);
Writeln('Tong day M = ',s2);
Readln;
End.
![](https://rs.olm.vn/images/avt/0.png?1311)
uses crt;
var i,t:integer;
begin
clrscr;
t:=0;
i:=5;
while i<=10 do
begin
t:=t+i;
i:=i+1;
end;
writeln(t);
readln;
end.
![](https://rs.olm.vn/images/avt/0.png?1311)
Var a:array[1..15] of integer;
i,s:integer;
Begin
I:=1;
While i<=15 do
Begin
Write('Nhap phan tu thu ',i,' = ');readln(a[i]);
s:=s+a[i];
i:=i+1;
End;
Write('Tong la ',s);
Readln;
End.
![](https://rs.olm.vn/images/avt/0.png?1311)
var s, i: real;
begin
s := 0;
for i := 1 to 50 do
s := s + 1/i;
writeln('Tong s = ', s:0:2);
end.
uses crt;
var i:integer;
begin
clrscr;
i:=10;
while i>=5 do
begin
write(i:4);
i:=i-1;
end;
readln;
end.