Write a C program to remove the repeated characters in the
entered expression or in entered characters(i.e) removing
duplicates

Answer Posted / balaji ganesh

#include<stdio.h>
main()
{
char s[50];
int i=0,j;
printf("enter character string:");
while((s[i]=getchar())!='\n')
{
for(j=0;j<i;j++)
if(s[j]==s[i])
i--;
i++;
}
printf("after removing the duplicates the string is:");
for(j=0;j<i;j++)
printf("%c",s[j]);
}

Is This Answer Correct ?    10 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

write a program to print largest number of each row of a 2D array

1866


what is the differnce between programing langauge and tool? is sas is a programing langauge r tool?

1896


Explain what are bus errors, memory faults, and core dumps?

784


What is sizeof array in c?

588


formula to convert 2500mmh2o into m3/hr

491






what are bit fields? What is the use of bit fields in a structure declaration?

1497


What is the use of linkage in c language?

611


What is a pointer in c plus plus?

687


What is difference between Structure and Unions?

634


What are the advantages of c preprocessor?

708


What is the purpose of the statement: strcat (S2, S1)?

638


What is malloc() function?

630


What is default value of global variable in c?

558


What are the advantages and disadvantages of a heap?

700


Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.

663