Viet chuong trinh nhap vao 2 so nguyen a va b(a { "@context": "https://schema.org", "@type": "QAPage", "mainEntity": { "@type": "Question", "name": " Viet chuong trinh nhap vao 2 so nguyen a va b(a
Viet chuong trinh nhap vao 2 so nguyen a va b(a { "@context": "https://schema.org", "@type": "QAPage", "mainEntity": { "@type": "Question", "name": " Viet chuong trinh nhap vao 2 so nguyen a va b(a
program ct;
uses crt;
var i,a,b,d1,d2:integer;
begin clrscr;
write(‘Nhap a va b: ‘); readln(a,b);
for i:=a to b do
begin
if i mod 3=0 then
begin
inc(d1);
write(i:3);
end;
write(‘Co ‘,d1,’ so chia het cho 3 trong doan tu ‘,a,’ den ‘,b);
if i mod 5=0 then
begin
inc(d2);
write(‘So dau tien thuoc [‘,a,’,’,b,’] chia het cho 5 la: ‘,i);
if d2=1 then break;
end;
end;
readln;
end.
Học tốt!