Difference between revisions of "Solução: Quermesse - OBI (Paulo Cesar)"
From AdonaiMedrado.Pro.Br
(New page: <code lang="c"> #include<stdio.h> #define MAX_SIZE 10000 int main() { int size, cont, num, cont_test; size = 1; cont_test = 1; while( size > 0 && size <= MAX_SIZE ) { scan...) |
|||
Line 17: | Line 17: | ||
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++; |
Revision as of 12:56, 1 April 2009
#include<stdio.h> #define MAX_SIZE 10000 int main() { int size, cont, num, cont_test; size = 1; cont_test = 1; while( size > 0 && size <= MAX_SIZE ) { scanf("%d",&size); for( cont = 0; (size > 0 && size <= MAX_SIZE), cont < size; cont++) { scanf("%d",&num); if( num == cont+1 ) { printf("Teste %d\n%d\n\n",cont_test,num); break; } } cont_test++; } return 0; }