主题:[讨论]没运行得 又找不出错!
#include <stdio.h>
#include <stdbool.h>
int main(void)
{
bool digit_seen[10]= {false};
int digit,x;
long n;
printf("Enter a number: ");
scanf("%ld",&n);
while(n>0){
digit =n%10;
if (digit_seen[digit])
scanf("%d",&x);
break;
digit_seen[digit] =true;
n\=10;
}
if(n>0)
printf("the repeated digit is:%d\n",x);
else
printf("No repeated digit\n");
return 0;
}
#include <stdbool.h>
int main(void)
{
bool digit_seen[10]= {false};
int digit,x;
long n;
printf("Enter a number: ");
scanf("%ld",&n);
while(n>0){
digit =n%10;
if (digit_seen[digit])
scanf("%d",&x);
break;
digit_seen[digit] =true;
n\=10;
}
if(n>0)
printf("the repeated digit is:%d\n",x);
else
printf("No repeated digit\n");
return 0;
}