|
|
back to boardWhy is this code wrong? var k,l : longint; BEGIN Read(k); for l := 2 to k-1 do if k mod (l+1) = 0 then begin Write(l); Exit; end; END. Re: Why is this code wrong? > var k,l : longint; > > BEGIN > Read(k); > for l := 2 to k-1 do if k mod (l+1) = 0 then > begin > Write(l); > Exit; > end; > END. If you got a wrong answer. I'll tell you if you still use 2 to k-1 you will also get a TimeLimitedError. try 3 to k/2 i got a AC in this way. REMBER you should carful with 2 |
|
|