Question: #include int main ( int argc, char const * argv [ ] ) { int input _ number; int digits _ seen [ 1 0

#include
int main(int argc, char const *argv[]){
int input_number;
int digits_seen[10]={0};
printf("Enter a number: ");
scanf("%d", &input_number);
int n = input_number;
int digit;
while ( n >0){
digit = n %10;
digits_seen[digit]+=1;
n /=10;
}
int hasRepeated =0;
for(int i =0; i <10; i++)
if (digits_seen[i]>1){
printf("%d is repeated %d times
", i, digits_seen[i]);
hasRepeated =1;
}
if (!hasRepeated)
printf("No repeated digit
");
return 0;
}
Having issues making this code produce the input and out below can anyone help improve this code?
Input:
ectoplasm
soylent
replicant
clockwork
strangelove
Output:
1221p133m
31y1132
31p1i2332
2112kw13k
32333g111v1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!