Guest User

Untitled

a guest
Jun 23rd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. int busca( int mat[][MAX],int n, int m, int N, float vetor[])
  2. {
  3. int i,j,k,aux;
  4.  
  5. for(k=0;k<N;k++)
  6. {
  7. printf("Informe o valor do %d vetor:", k+1 ); // le o vetor
  8. scanf("%f",&vetor[k]);
  9. }
  10.  
  11. for (i =0; i < n ;i ++)
  12. {
  13. for ( j = 0; j < m ;j ++)
  14. {
  15. printf ("Digite mat [%d][%d]: ",i , j) ; //le a matriz
  16. scanf ("%d",&mat [i][j]) ;
  17. }
  18. }
  19.  
  20. //aqui seria a logica pra achar o elemento igual
  21. for(i=0; i<n;i++)
  22. {
  23. for(j=0;j<m;j++)
  24. {
  25. if(mat[i][j] == vetor[k])
  26. {
  27. return i;
  28.  
  29. }
  30. }
  31. }
  32.  
  33. if (i>=0)
  34. printf(" A primeira ocorrencia do vetor eh na linha %dn.",i-1 );
  35. else
  36. return -1;
  37.  
  38.  
  39. }
Add Comment
Please, Sign In to add comment