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 do you know about the use of bit field?
What is difference between scanf and gets?
How are 16- and 32-bit numbers stored?
What is a pointer and how it is initialized?
An arrangement of information in memory in such a way that it can be easily accessed and processed by a programming language a) string b) data structure c) pointers d) array
What are the salient features of c languages?
What does volatile do?
Is c# a good language?
Compare array data type to pointer data type
what is the basis for selection of arrays or pointers as data structure in a program
What is extern storage class in c?
How to define structures? ·
What is floating point constants?
Where in memory are my variables stored?
What are qualifiers and modifiers c?