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
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 |
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 |
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 |
Derive the complexity expression for AVL tree?
why arithmetic operation can’t be performed on a void pointer?
implement NAND gate logic in C code without using any bitwise operatior.
the factorial of non-negative integer n is written n! and is defined as follows: n!=n*(n-1)*(n-2)........1(for values of n greater than or equal to 1 and n!=1(for n=0) Perform the following 1.write a c program that reads a non-negative integer and computes and prints its factorial. 2. write a C program that estimates the value of the mathematical constant e by using the formula: e=1+1/!+1/2!+1/3!+.... 3. write a c program the computes the value ex by using the formula ex=1+x/1!+xsquare/2!+xcube/3!+....
What is the g value paradox?
which is the best site or book for learning C...and i need the content for C..how to get the good programming skills....? can plz suggest me....
What is pointer to pointer in c?
Explain how do you determine whether to use a stream function or a low-level function?
what is difference between overriding and overloading?
What is the difference between c and python?
Hi how many types of software editions are there and their difference (like home editions, enterprise, standard etc) can u please help me
Define Spanning-Tree Protocol (STP)