-2
Enter the data in VET, and then check the repeated numbers, and leave in VET1 only the numbers that are not repeated, but I’m not able to do this last part at all, follow the code I’ve done so far:
#include <stdio.h>
#include <stdlib.h>
#define T 3
int main()
{
int vet[T];
int vet1[T];
int i, j, achou = 0, quant = 0;
printf("Digitar os numeros:");
for(i = 0; i < T; i++)
{
scanf("%d", &vet[i]);
}
for(i = 0; i < T; i++)
{
for(j = 0; j < quant; j++)
{
achou = 0;
if(vet[i] == vet1[j])
{
achou = 1;
break;
}
if(achou == 0)
{
vet1[quant] = vet[i];
quant ++;
}
}
}
for (i = 0; i <= quant; i++)
{
printf("%d", vet[i]);
}
return 0;
}
the second loop will never run pq Uant is zero
– Felipe
even moving to T, still does not work :/
– WeslleyAF