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
Do you know null pointer?
How is null defined in c?
an expression contains relational operators, assignment operators, and arithmatic operstors. In the absence of parentheses, they will be evaluated in which of the following order a) assignment, relational, arithematic b) arithematic, relational, assignment c) relational, arithematic, assignment d) assignment, arithematic, relational
Describe explain how arrays can be passed to a user defined function
Create a structure to specify data on students given below: Roll number, Name, Department, Course, Year of joining Assume that there are not more than 450 students in the college. 1.write a function to print names of all students who joined in a particular year 2.write a function to print the data of a student whose roll number is given
What is the heap?
Where static variables are stored in c?
how could explain about job profile
Write a program that accept anumber in words
How can I use a preprocessorif expression to ?
Which operators cannot be overloaded a) Sizeof b) .* c) :: d) all of the above
Subtract Two Number Without Using Subtraction Operator
What is the significance of an algorithm to C programming?
How can I swap two values without using a temporary?
Explain what does a function declared as pascal do differently?