Difference between revisions of "Solução: Quermesse - OBI (Paulo Cesar)"

From AdonaiMedrado.Pro.Br
Jump to: navigation, search
 
Line 1: Line 1:
 
<code lang="c">
 
<code lang="c">
 
#include<stdio.h>
 
#include<stdio.h>
 
+
 
int main()
 
int main()
 
{
 
{
Line 7: Line 7:
 
   size = 1;
 
   size = 1;
 
   cont_test = 1;
 
   cont_test = 1;
 
+
 
   while( size > 0 )
 
   while( size > 0 )
 
   {
 
   {
Line 15: Line 15:
 
       scanf("%d",&num);
 
       scanf("%d",&num);
 
       if( num == cont+1 )
 
       if( num == cont+1 )
      {
 
 
         printf("Teste %d\n%d\n\n",cont_test,num);
 
         printf("Teste %d\n%d\n\n",cont_test,num);
        break;
 
      }
 
 
     }
 
     }
 
     cont_test++;
 
     cont_test++;
 
   }
 
   }
 
+
 
   return 0;
 
   return 0;
 
}
 
}
 
</code>
 
</code>

Latest revision as of 13:44, 1 April 2009

#include<stdio.h>
 
int main()
{
  int size, cont, num, cont_test;
  size = 1;
  cont_test = 1;
 
  while( size > 0 )
  {
    scanf("%d",&size);
    for( cont = 0; size > 0, cont < size; cont++)
    {
      scanf("%d",&num);
      if( num == cont+1 )
        printf("Teste %d\n%d\n\n",cont_test,num);
    }
    cont_test++;
  }
 
  return 0;
}