Guest User

Untitled

a guest
Jan 21st, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int Array(int array[], int n, int x)
  5. {
  6. int array[7] = {1,2,3,4,5,6,7};
  7. int i;
  8. for (i = 0; i < n; i++)
  9. {
  10. if (a[i] == x)
  11. {
  12. printf("Este valor pertence ao array e esta na posicao %d\n", &i);
  13. return 0;
  14. }
  15. else
  16. printf("Este valor não pertence ao array\n");
  17. return -1;
  18. }
  19. }
  20.  
  21. int main(void)
  22. {
  23. printf("Entre com uma valor de x:\n");
  24. scanf("%d" &x);
  25.  
  26. Array(array, 7, x);
  27.  
  28. return 0;
  29. }
Add Comment
Please, Sign In to add comment