سلام شادی خانم می تونین برنامه مورد نظرتونو از ادرس زیر بردارید
کد:
program test ;
uses crt ;
const g = 300 ;
type
arr = array[1..g] of integer ;
var
x , y : arr ;
i , j , k , n , m , l , o: integer ;
key : boolean ;
begin
clrscr;
{written by: navid}
writeln('pleas enter n number, for finsh insert 0:');
i := 0;
repeat
i := i + 1;
readln(y[i]);
until y[i] = 0;
l := i - 1;
o := 1;
while o <= l do
begin
n := y[o];
m := n div 2;
x[1] := 2 ;
k := 1 ;
for i := 3 to m do
begin
key := true ;
j := 1 ;
while (j <= k) and key do
if (i mod x[j]) = 0 then
key := false
else
j := j + 1;
if key then
begin
k := k + 1;
x[k] := i
end ;
end;
write('the result for number ',y[o],' is : ');
i:=1;
while ( i <= k ) do
begin
if (n mod x[i]) = 0 then
begin
write(x[i],' * ');
n := n div x[i];
i := i - 1;
end;
i:=i+1;
end;
writeln;
o := o + 1;
end;
readln;
end.