偶把自己的代码放上来好了
# include <stdio.h>
int main (void)
{
long int number_input ;
int digit , digit_counted ;
int digit_seen[10] = {0};
printf("Enter a number : ");
scanf("%ld",&number_input);
printf("Repeated number: ");
for ( ; number_input > 0 ; number_input /= 10)
{
digit = number_input % 10;
if(digit_seen[digit] == 1 && digit_counted != digit)
printf(" %d ",digit);
digit_seen[digit] = 1;
digit_counted = digit;
}
getch();
return 0;
}
我自己调试时有点小问题...请大家指教