program tong_chiahet3; uses crt; var m,n,i,s:integer; begin clrscr; write(‘Nhap M: ‘); readln(m); write(‘Nhap N: ‘); readln(n); s:=0; for i:=m to n do if i mod 3=0 then s:=s+i; write(‘Tong cac so chia het cho 3 tu ‘,m,’ den ‘,n,’ la: ‘,s); readln; end. Bình luận
var m,n,t,i: longint;begin write(‘Nhap m: ‘); readln(m); write(‘Nhap n: ‘); readln(n); for i:=m to n do if (i mod 3 = 0) then t:=t+i; writeln(‘Tong tat ca cac so chia het cho 3 tu ‘,m,’ toi ‘,n,’ la: ‘,t,’.’); readlnend. Bình luận
program tong_chiahet3;
uses crt;
var m,n,i,s:integer;
begin
clrscr;
write(‘Nhap M: ‘); readln(m);
write(‘Nhap N: ‘); readln(n);
s:=0;
for i:=m to n do
if i mod 3=0 then s:=s+i;
write(‘Tong cac so chia het cho 3 tu ‘,m,’ den ‘,n,’ la: ‘,s);
readln;
end.
var m,n,t,i: longint;
begin
write(‘Nhap m: ‘);
readln(m);
write(‘Nhap n: ‘);
readln(n);
for i:=m to n do
if (i mod 3 = 0) then t:=t+i;
writeln(‘Tong tat ca cac so chia het cho 3 tu ‘,m,’ toi ‘,n,’ la: ‘,t,’.’);
readln
end.