Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Este código foi feito para o teste prático de algoritmos 2
- // Código para fins didáticos.
- #include<stdio.h>
- #define vMAX 10
- int procure(int por,int *vetor,int tamanho)
- {
- if(por==vetor[tamanho]) return tamanho;
- else if (tamanho<=vMAX) procure(por,vetor,tamanho+1);
- return -1;
- }
- main()
- {
- int numero,valor=0,indice,vetor[5];
- for(indice=0;indice <5;indice++)
- {
- scanf("%d",&vetor[indice]);
- }
- scanf("%d",&numero);
- valor = procure(numero,vetor,0);
- printf("valor retornado %d ",valor);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement