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
How many keywords (reserve words) are in c?
What is #include stdio h?
What are data types in c language?
Explain about block scope in c?
Can an array be an Ivalue?
Why is sizeof () an operator and not a function?
What are control structures? What are the different types?
Explain about C function prototype?
If a variable is a pointer to a structure, then which operator is used to access data members of the structure through the pointer variable?
What are the 5 types of organizational structures?
How macro execution is faster than function ?
What are runtime error?
What is the meaning of && in c?
What is assert and when would I use it?
Why is c called c not d or e?