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

Answers were Sorted based on User's Feedback



Write a C program to remove the repeated characters in the entered expression or in entered charact..

Answer / 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

Write a C program to remove the repeated characters in the entered expression or in entered charact..

Answer / nallavelli srinivas

MAIN()
{ int lsu=0;
char name[50];
pf("enter the string");
sf("%S",name);

printf(name[0]);
while(name[i]!='\0')
{
if(name[i]!=lsu){pf(name[i]);
lsu=name[i];
}
}
}

Is This Answer Correct ?    1 Yes 5 No

Write a C program to remove the repeated characters in the entered expression or in entered charact..

Answer / 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

More C Interview Questions

a way in which a pointer stores the address of a pointer which stores the value of the target value a) reference b) allocation c) multiple indirection d) none

0 Answers  


What is mean by Data Driven framework in QTP? Can any one answer me in details on this regard.

0 Answers   IBM,


Is null equal to 0 in sql?

0 Answers  


Is reference used in C?

1 Answers  


When I tried to go into a security sites I am denied access and a message appeared saying 'applet not initialize'. How can I rectify this problem.

0 Answers   HCL,






What is C language Terminator?

15 Answers   TCS,


Why structure is used in c?

0 Answers  


Why c is procedure oriented?

0 Answers  


What are different storage class specifiers in c?

0 Answers  


how to print 212 as Twohundreds twelve plz provide me ans soon

1 Answers  


Explain what is the benefit of using enum to declare a constant?

0 Answers  


What is typedef example?

0 Answers  


Categories