Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int Array(int array[], int n, int x)
- {
- int array[7] = {1,2,3,4,5,6,7};
- int i;
- for (i = 0; i < n; i++)
- {
- if (a[i] == x)
- {
- printf("Este valor pertence ao array e esta na posicao %d\n", &i);
- return 0;
- }
- else
- printf("Este valor não pertence ao array\n");
- return -1;
- }
- }
- int main(void)
- {
- printf("Entre com uma valor de x:\n");
- scanf("%d" &x);
- Array(array, 7, x);
- return 0;
- }
Add Comment
Please, Sign In to add comment