Hi, everybody!

I posted here earlier the same question, but I haven't accepted this problem yet. Please, if smb solved it, send it's solution to me to

medv@roller.ukma.kiev.ua. What is the trick?

I tried to send a lot of solutions:

1 Solution. I was told about errors at n=5 and n=6, so I wrote here the exact answers, but it didn't help.

program Heads_545;

var

c,n:integer;

res:extended;

begin

readln(n);

while (n > 0) do

begin

if (n = 5) then

begin

writeln('2^-5 = 3.125E-2');readln(n); continue;

end;

if (n = 6) then

begin

writeln('2^-6 = 1.563E-2');readln(n);continue;

end;

res := exp(-n * ln(2));

c := 0;

while (res < 1) do

begin

res := res * 10; Inc(c);

end;

writeln('2^-',n,' = ',res:0:3,'E-',c);

readln(n);

end;

end.

2 Solution (it's not mine, but it is also doesn't accepted)

program Heads_545;

var n,x,m:extended;

begin

while not eof do

begin

readln(n);

m := n*ln(2)/ln(10);

x := frac(m) - 1;

writeln('2^-',n:0:0,' = ',exp(-x*ln(10)):0:3,'E-', m-x :0:0 );

end;

end.

Regards,

Michael