ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Google
   
 
Categories >> Software >> Programming Languages >> C
 
 


 

 
 C interview questions  C Interview Questions (2265)
 C++ interview questions  C++ Interview Questions (1119)
 VC++ interview questions  VC++ Interview Questions (342)
 Delphi interview questions  Delphi Interview Questions (510)
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions (648)
Question
Write a C program to remove the repeated characters in the
entered expression or in entered characters(i.e) removing
duplicates
 Question Submitted By :: C
I also faced this Question!!     Answer Posted By  
 
Answer
# 1
#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
Balaji Ganesh
 
Answer
# 2
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
Nallavelli Srinivas
 
 
 
Answer
# 3
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
Sowjanya
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
C,c++, Java is all are structural oriented or procedure oriented language..?   6
Predict the output or error(s) for the following: 25. main() { printf("%p",main); } ME 3
what is difference between ANSI structure and C99 Structure? Wipro 1
c program to subtract between two numbers without using '-' sign and subtract function.   1
What is the difference between macros and inline functions? L&T 3
write a method for an array in which it can display the largest n next largest value. Value-Labs 1
what is unsigened char and what is the difference from char   2
WHAT WILL BE OUTPUT OF BELOW CODE . . AND PLEASE EXPLAIN HOW IT COME .. #include<stdio.h> #include<conio.h> void main() { int k=20; printf("%d%d%d%d",k,k++,++k,k); getch(); }   25
wat is the output #define VOLEDEMORT _who_must_not_be_named int main() { printf("VOLEDEMORT"); }   2
write a program which will count occurance of a day between two dates. IonIdea 1
what is void pointer?   2
what is diff between localstatic and globalstatis variable possible 2 use in another file...? HCL 2
 
For more C Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com