Ba
̀
i 1: !"#$
%$&'(')*+
,-. !
Program P3203;
Uses CRT;
Var N, i: word;
Begin
write(' Cho số tự nhiên N: '); readln(N);
writeln(N, '=');
i:=2
While N>1 do
Begin
if N div i = 0 then
Begin
write(i, '*');
N:= N div i;
end
else
inc(i);
end;
readln;
End.
Ba
̀
i 2 /0.1#$%#2345
6$71(,-. +.89,?
Program P3201;
Uses CRT;
Var n, i: integer;
Begin
write('Hãy nhập một số tự nhiên: );
readln(n);
i:=2;
While (i<= SQRT(n)) and (n mod i>0)
do inc(i);
if i> SQRT(n) then
writeln(n, 'là số nguyên tố ')
else
writeln(n, ' là hợp số');
End.
+
:;<
49
1=
&
,>9
Program So_lon;
Var
so1,so2,so3,so4,solon1,solon2,sol
on:Integer;
Begin
Writeln('TIM SO LON NHAT
TRONG 4 SO NGUYEN');
Writeln('Cau truc
If...Then...Else');
Writeln('------------------------
-');
Write('-Nhap so thu nhat: ');
Readln(so1);
Write('-Nhap so thu hai : ');
Readln(so2);
Write('-Nhap so thu ba : ');
Readln(so3);
Write('-Nhap so thu tu : ');
Readln(so4);
If so1 > so2 Then
solon1:= so1
Else
Solon1:=so2;
If so3 > so4 Then
solon2:=so3
Else
solon2:=so4;
If solon1 > solon2 Then
solon:=solon1
Else
solon:=solon2;
Writeln;
Writeln('+So lon nhat trong
4 so la: ',solon);
Writeln;
Writeln('Bam phim <Enter>
de ket thuc');
Readln
End.
+>&<
9
+
+9
,-.
9
Program thuaso;
Var
n,i:Integer;
Begin
Writeln('PHAN TICH N THANH
TICH CAC THUA SO NGUYEN TO');
Writeln('------------------------
--------------------');
Write('-Nhap so N= ');
Readln(n);
Repeat
i:=2;
While (n Mod i <> 0) And (i
< n ) Do
i:=i + 1;
Write(i:4);
n:=n Div i;
Until n=1;
Writeln;
Writeln(' Bam phim <Enter>
de ket thuc');
Readln
End.