Spoj PRIME1

Problem link please find out why this code is not printing 2 for test case ie

Input:

2
1 10
3 5

Output:
2
3
5
7
3
5

here is code…


**program PRIME1;
uses Math;**

<var>
var
   T:integer;
   N,M:longint;
   i,y,pos:longint;
</var>
begin
	
	read(T);
	
	while T <> 0 do
	begin
	readln(M,N);
	
	for i := M to N do
	begin
	pos := ceil(sqrt(i));
	for y := 2 to pos do
	begin
	if i mod y = 0 then break
	else continue;
    end;
	if (i mod y <> 0) and (i > 1) then
	writeln(i);
	end;
	writeln;
	T := T-1;
	end;
end.


if you have any doubts related to any of your answers and want to LEARN and SHARE good tricks and concepts in coding.join our coding community and let us all coders rock

link:https://www.facebook.com/codesharing0

it is due to ceil function ceil(sqrt(2))=2

hence your program breaks when i%y==0 (2%2==0)