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

What do you know about the use of bit field?

614


What is difference between scanf and gets?

616


How are 16- and 32-bit numbers stored?

726


What is a pointer and how it is initialized?

611


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

688






What are the salient features of c languages?

627


What does volatile do?

569


Is c# a good language?

614


Compare array data type to pointer data type

603


what is the basis for selection of arrays or pointers as data structure in a program

3790


What is extern storage class in c?

515


‎How to define structures? · ‎

633


What is floating point constants?

695


Where in memory are my variables stored?

639


What are qualifiers and modifiers c?

551