Write a C program to remove the repeated characters in the
entered expression or in entered characters(i.e) removing
duplicates

Answer Posted / sowjanya

void main()
{
int rep=0;
char ch,str[50];
printf("enter the string:"):
scanf("%s",str);
printf("enter the character:");
scanf("%s",ch);
for(int i=0;str[i]!='/0';i++)
{
if(str[i]==ch)
{
rep++;//to count character
str[i]=' ';//to delete the duplicate
}
}
printf("the character is repeated %d times",rep);
printf("now all duplicates are deleted.");
}

Is This Answer Correct ?    5 Yes 13 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Do you know null pointer?

600


How is null defined in c?

649


an expression contains relational operators, assignment operators, and arithmatic operstors. In the absence of parentheses, they will be evaluated in which of the following order a) assignment, relational, arithematic b) arithematic, relational, assignment c) relational, arithematic, assignment d) assignment, arithematic, relational

805


Describe explain how arrays can be passed to a user defined function

597


Create a structure to specify data on students given below: Roll number, Name, Department, Course, Year of joining Assume that there are not more than 450 students in the college. 1.write a function to print names of all students who joined in a particular year 2.write a function to print the data of a student whose roll number is given

2508






What is the heap?

681


Where static variables are stored in c?

581


how could explain about job profile

1446


Write a program that accept anumber in words

1248


How can I use a preprocessorif expression to ?

594


Which operators cannot be overloaded a) Sizeof b) .* c) :: d) all of the above

654


Subtract Two Number Without Using Subtraction Operator

348


What is the significance of an algorithm to C programming?

592


How can I swap two values without using a temporary?

610


Explain what does a function declared as pascal do differently?

634