We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1
Uses Crt;
Type uoc_nguyen_to=array[1..50] of longint;
Var u, N: longint; i, dem: integer; a: uoc_nguyen_to; (*================================*) Procedure nhap(Var NN:longint); Begin Repeat Write('Nhap N='); Readln(NN); Until NN>=0; End; (*=================================*) Procedure viet; Begin If dem=0 then Writeln('So ',N,' khong the phan tich thanh ' + 'tich cua cac so nguyen to') Else If dem=1 then Writeln(N, '=', a[dem]) Else Begin Write(N,'='); For i:=1 to dem-1 do Write(a[i],'*'); Writeln(a[dem]); End; End; (*================================*) Procedure phantich(N1:longint); Begin If N1>1 then Begin u:=2; dem:=0; Repeat If (N1 mod u=0) then Begin inc(dem); a[dem]:=u; N1:=N1 div u; End Else inc(u); Until N1=1; End Else dem:=0; Viet; End; (*==============================*) BEGIN (* Main Program *) Clrscr; Writeln('Phan tich so N thanh tich cua cac so nguyen to :'); nhap(N); phantich(N); Write('Nhan Enter de ket thuc ...'); Readln; END .