(1)S 的全部数字。除最后一行外,每行输出 50 位数字。
(2) 乘积的数字位数。
例1:输入p=13,由于13*8547=111111,则应输出 ① 8547, ②6
例2:输入p=147,则输出结果应为
①755857898715041572184429327286470143613,②42,即等式的右端有42个1。
程序:
program ex402;
var
p,a,b,c,t,n:longint;
begin
while (true) do
begin
writeln ('Input p, the last digit is 1 or 3 or 7 or 9:');
readln(p);
if (p mod 2<>0)and(p mod 5<>0) then
1 {如果输入的数符合要求,结束循环 }
end;
a:=0;
n:=0;
while (a<p) do
begin
a:=a*10+1; inc(n);
end;
t:=0;
repeat
b:=a div p;
write(b:1);
inc(t);
if ( 2 ) then writeln;
c:= 3 ;
a:= 4
inc(n);
until c<=0;
dec(n);
writeln;
writeln('n=', 5 );
end. 