program macaco_prego;
{
  Autor (es): Diego Hachmann, Lucas Batistussi
  Data: 20/08/07
  Função: Dadas as coordenadas de regiões, o programa calcula a região de
          intersecção das mesmas, esta que é a melhor área para a reserva ambiental
          que abrigará o macaco-prego.
  Arquivo: mamaco.pas
}
var
x,y,u,v,i,teste,x1,y1,u1,v1,n: integer;

begin
teste:=0;
readln (n);

begin
 
     while n>0 do
     begin 
 
 	   readln (x,y,u,v);
 
 	   for i:=2 to n do
       begin
 	       readln (x1,y1,u1,v1);
 
          if x1>x then x:=x1;
 	      if y1<y then y:=y1;
 	      if u1<u then u:=u1;
 	      if v1>v then v:=v1;
 
 	   end;
     
 	   teste:= teste+1;
 
 	   writeln (&#039;Teste &#039;,teste);
 
	   if ((y<v) or (u<x)) then
 	      writeln (&#039;Nenhum&#039;)
 	   else
 	       writeln (x,&#039; &#039;,y,&#039; &#039;,u,&#039; &#039;,v);
 		
       writeln;
 	
       readln (n);
 	
	end;
end;
  
end.

Add a code snippet to your website: www.paste.org