POR FAVOR. Alguém poderia me ajudar nesse programa? Estou querendo salvar a quantidade dos números repetidos em um vetor.
#include<stdio.h>
#include<Stdlib.h>
int main()
{
int i,vetor[6];
for (i=0;i<6;i++)
{
printf ("digite um numero pra cada posicao %d:",i);
scanf("%d",&vetor*);*
*
*
*
}*
*
printf("\nimprimindo o vetor ");*
*
for(i=0;i<6;i++)*
*
{*
*
printf("%d ",vetor**);*
*
}*
*
int k,r,a;*
*
int y=1, vetornr[y];*
*
int cont=0;*
*
int cont2=0;*
*
for (i=0;i<6;i++)*
*
{*
*
for(k=i+1;k<6;k++)*
*
{*
*
if (vetor**==vetor[k])*
*
{*
*
printf("\n o NUMERO %d se repete na posicao %d e %d",vetor[k],i,k);*
*
vetornr[y]=vetor[k]; *
*
y++;*
*
*
*
} *
*
*
*
} *
*
}*
*
*
*
/imprimindo vetor numeros repetidos/*
*
for(i=1;i<y;i++)*
*
{*
*
*
*
printf("\no(s) numero(s) repetido(s) sao :%d ",vetornr**);*
*
}*
*
return(0);*
*
}
*Discussão (0)
Carregando comentários...