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
What would the following code segment printint k = 8;docout << "k = " << k << " ";while k++ < 5; a) 13 b) 5 c) 8 d) pointers
Explain how can a program be made to print the line number where an error occurs?
Why header file is used in c?
What is function and its example?
What is the need of structure in c?
Write a program in c to replace any vowel in a string with z?
Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database.
What does. int *x[](); means ?
application attempts to perform an operation?
How does sizeof know array size?
how we can make 3d venturing graphics on outer interface
Function which gives a pointer to a binary trees const an integer value at each code, return function of all the nodes in binary tree.?
Can you mix old-style and new-style function syntax?
How can I get the current date or time of day in a c program?
why arguments can generally be passed to functions a) sending the values of the arguments b) sending the addresses of the arguments c) a & b d) none of the above