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 (2262)
 C++ interview questions  C++ Interview Questions (1118)
 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
 
n=7623 { temp=n/10; result=temp*10+ result; n=n/10 } Wipro 7
what is mallloc()?how it works? Excel 4
write a program in reverse the string without using pointer,array,global variable declaration,lib fun only using a function? HCL 5
What are .h files and what should I put in them?   3
Identify the correct argument for the function call fflush () in ANSI C: A)stdout B)stdin C)stderr D)All the above Accenture 5
how does a general function , that accepts an array as a parameter, "knows" the size of the array ? How should it define it parameters list ? TCS 2
write a program in 'c' to find the value of p[i+1]^n.p,i,n are arguments of a macro and n is a integer   1
How does C++ help with the tradeoff of safety vs. usability?   1
how many keywords do C compile? Microsoft 7
write a C code to reverse a string using a recursive function, without swapping or using an extra memory. Motorola 9
what is the difference between <stdio.h> and "stdio.h" Kanbay 13
Which of the following sorts is quickest when sorting the following set: 1 2 3 5 4 1) Quick Sort 2) Bubble Sort 3) Merge Sort   7
 
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