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
hi... can anyone help me to make a two-dimensinal arrays in finding the sum of two elements plzzz. thnx a lot...
What is clrscr ()?
What is a union?
Why can’t constant values be used to define an array’s initial size?
#include
What are the primitive data types in c?
Difference between MAC vs. IP Addressing
Describe the order of precedence with regards to operators in C.
I need previous papers of CSC.......plz help out by posting them.......
Is null equal to 0 in sql?
What math functions are available for integers? For floating point?
What is the difference between #include
What are qualifiers?
Explain how can a program be made to print the name of a source file where an error occurs?
What is the use of sizeof () in c?