The question asked me to make a code that would store 10 integer values, check if there were any numbers repeated, and if there were, print the repeated numbers, but my code or printe some numbers repeated more than once, or printa one once. How can I fix this?
#include <stdio.h>
#include <stdlib.h>
#define N 10
int main (){
int i,Vetor[N],aux[N]={0,0,0,0,0,0,0,0,0,0},count=0,j;
for(i=0;i<N;i++){
printf("insira o %dº número\n",i+1);
scanf("%d",&Vetor[i]);
}
for(i=0;i<N;i++){
for(j=i+1;j<N;j++){
if(Vetor[i]==Vetor[j]){
count++;
aux[i]=Vetor[i];
}
}
}
printf("existem %d números iguais\n",count);
printf("os números que aparecem repetidos são:\n");
for(i=0;i<N;i++){
if(aux[i]!=0)
printf("%d\n",aux[i]);
}
return 0;
}