Viết chương trình in ra tất cả các ước của 1 số n ( n đc nhập từ bàn phím)

2 câu trả lời

Program BTT;
Uses crt;
Var n,i: longint;
Begin
        Clrscr;
        Write('Nhap n: '); Readln(n);
        Write('Cac uoc cua n: ');
        For i:=1 to n do
                If n mod i = 0 then Write(i,' ');
        Readln
End.

Program BTH;
uses crt;
var n,i:longint;
Begin
        clrscr;
        write('Nhap n: ');readln(n);
        writeln('U cua ',n,' la: ');
        for i:=1 to n do
        If n mod i=0 then write(i,' ');
readln;
end.