#include <stdio.h>
#define TAMANHO 5
int existe(int* vetor, int tamanho, int elemento){
int i;
for (i = 0; i < tamanho; ++i){
if (vetor[i] == elemento) return 1;
}
return 0;
}
int main(void)
{
int vetA[TAMANHO], vetB[TAMANHO], vetC[TAMANHO*2], i;
printf ("Informe %d valores para o VETOR A:\n\n", TAMANHO
); for (i=0; i<TAMANHO; i++)
printf ("\nInforme %d valores para o VETOR B:\n\n", TAMANHO
); for (i=0; i<TAMANHO; i++)
int tamC = 0;
for (i = 0; i < TAMANHO; ++i)
if (!existe(vetC, tamC, vetA[i])) vetC[tamC++] = vetA[i];
for (i = 0; i < TAMANHO; ++i)
if (!existe(vetC, tamC, vetB[i])) vetC[tamC++] = vetB[i];
printf ("\nA uniao dos vetores e:\n\n");
for (i=0; i<tamC; i++)
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNkZWZpbmUgVEFNQU5ITyA1CgppbnQgZXhpc3RlKGludCogdmV0b3IsIGludCB0YW1hbmhvLCBpbnQgZWxlbWVudG8pewogICAgaW50IGk7CiAgICBmb3IgKGkgPSAwOyBpIDwgdGFtYW5obzsgKytpKXsKICAgICAgICBpZiAodmV0b3JbaV0gPT0gZWxlbWVudG8pIHJldHVybiAxOwogICAgfQoKICAgIHJldHVybiAwOwp9CgppbnQgbWFpbih2b2lkKQp7CiAgICBpbnQgdmV0QVtUQU1BTkhPXSwgdmV0QltUQU1BTkhPXSwgdmV0Q1tUQU1BTkhPKjJdLCBpOwoKICAgIHByaW50ZiAoIkluZm9ybWUgJWQgdmFsb3JlcyBwYXJhIG8gVkVUT1IgQTpcblxuIiwgVEFNQU5ITyk7CiAgICBmb3IgKGk9MDsgaTxUQU1BTkhPOyBpKyspCiAgICAgICAgc2NhbmYgKCIlZCIsICZ2ZXRBW2ldKTsKCiAgICBwcmludGYgKCJcbkluZm9ybWUgJWQgdmFsb3JlcyBwYXJhIG8gVkVUT1IgQjpcblxuIiwgVEFNQU5ITyk7CiAgICBmb3IgKGk9MDsgaTxUQU1BTkhPOyBpKyspCiAgICAgICAgc2NhbmYgKCIlZCIsICZ2ZXRCW2ldKTsKCiAgICBpbnQgdGFtQyA9IDA7CgogICAgZm9yIChpID0gMDsgaSA8IFRBTUFOSE87ICsraSkKICAgICAgICBpZiAoIWV4aXN0ZSh2ZXRDLCB0YW1DLCB2ZXRBW2ldKSkgdmV0Q1t0YW1DKytdID0gdmV0QVtpXTsKCiAgICBmb3IgKGkgPSAwOyBpIDwgVEFNQU5ITzsgKytpKQogICAgICAgIGlmICghZXhpc3RlKHZldEMsIHRhbUMsIHZldEJbaV0pKSB2ZXRDW3RhbUMrK10gPSB2ZXRCW2ldOwoKCiAgICBwcmludGYgKCJcbkEgdW5pYW8gZG9zIHZldG9yZXMgZTpcblxuIik7CgogICAgZm9yIChpPTA7IGk8dGFtQzsgaSsrKQogICAgICAgIHByaW50ZiAoIiVkLCAiLCB2ZXRDW2ldKTsKCgogICAgcmV0dXJuIDA7Cn0KCgo=
Informe 5 valores para o VETOR A:
Informe 5 valores para o VETOR B:
A uniao dos vetores e:
1, 2, 3, 4, 5, 6, 7,