Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

5-8 What are the advantages and disadvantages of the BYOD movement?

Answered: 1 week ago