0 bình luận về “Viết chương trình In ra số ước của N?”
program In_Ra_So_Uoc_Cua_N; uses crt; var n,i:integer; begin writeln(‘Nhap vao n:’); readln(n); if n<0 then write(‘N la so am, khong thuc hien duoc cau lenh nay’); for i:=1 to n do if n mod i = 0 then write(i:3,’,’); readln end.
program In_Ra_So_Uoc_Cua_N;
uses crt;
var n,i:integer;
begin
writeln(‘Nhap vao n:’); readln(n);
if n<0 then write(‘N la so am, khong thuc hien duoc cau lenh nay’);
for i:=1 to n do if n mod i = 0 then
write(i:3,’,’);
readln
end.
program ct;
uses crt;
var i,N:integer;
begin clrscr;
write(‘Nhap so N: ‘); readln(N);
writeln(‘Uoc cua N la: ‘);
for i:=1 to N do
if N mod i=0 then write(i:3);
readln;
end.
Học tốt!