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 |
int x=5; printf("%d%d%d",x,x<<2,x>>2);
What are control structures? What are the different types?
write a c program to remove all the duplicate characters in a string and replace with single character? ex:-input- AAABBBCCC output- ABC
What is class and object in c?
Which header file is used for clrscr?
A routine usually part of the operation system that loads a program into memory prior to execution a) linker b) loader c) preprocessor d) compiler
4) Write a program that takes a 5 digit number and calculates 2 power that number and prints it.
how to sort two array of characters and make a new array of characters.
write a program to generate 1st n fibonacci prime number
C program code int zap(int n) { if(n<=1)then zap=1; else zap=zap(n-3)+zap(n-1); } then the call zap(6) gives the values of zap [a] 8 [b] 9 [c] 6 [d] 12 [e] 15
When should the volatile modifier be used?
what is the other ways to find a logic to print whether a number is an even or odd wit out using % symbol??????? i know three different ways to print it. so i need any other different logic>>>>>