Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


To 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



To Write a C program to remove the repeated characters in the entered expression or in entered cha..

Answer / surya

Please send some important programming asked by product companies
to this mail id suryabharathi8@gmail.com

by
Surya

Is This Answer Correct ?    0 Yes 0 No

To Write a C program to remove the repeated characters in the entered expression or in entered cha..

Answer / naveen

#include<stdio.h>
#include<string.h>
int main()
{
char a[100];
char b[100];
int i,j,k,l,m=0;
printf("enter the string
");
scanf("%s",a);
l=strlen(a);
for(i=0;i<l;i++)
{
k=0;
for(j=0;j<l;j++)
{
if(a[i]==b[j])
{
k++;
}
}
if(k==0)
{
b[m]=a[i];
m++;
}
}
b[m]='';
strcpy(a,b);
printf("after removing duplicates
");
printf("%s
",a);
return 0;

}

Is This Answer Correct ?    2 Yes 2 No

To Write a C program to remove the repeated characters in the entered expression or in entered cha..

Answer / ankith

#include<stdio.h>
#include<string.h>
#include<stdlib.h>

void check(char c,char str[],int len)
{
while(*(str+len))
{
if(str[len]==c)
str[len]='/';
len++;
}
}

void main()
{
char str[100];
char p[100],flag='/',c;
int llen=0,flen=0;
scanf("%s",str);
while(str[flen])
{
if(str[flen]=='/')
{
flen++;
continue;
}
else
{
c=str[flen++];
p[llen++]=c;
check(c,str,flen);
}
}
printf("%s ",p);
}

Is This Answer Correct ?    0 Yes 0 No

To Write a C program to remove the repeated characters in the entered expression or in entered cha..

Answer / avinash

#include<stdio.h>
int main()
{int i,j,k;
char a[]="avinash";


for(i=0;i=5;i++)
{

for(j=(i+1);j=6;j++)
{
if(a[j]==a[i])
{ for(k=j;k<=6;k++)
a[k]=a[k+1];
}

}

for(i=0;i<7;i++)
printf("%c",a[i]);

}
return(0);
}

Is This Answer Correct ?    4 Yes 4 No

To Write a C program to remove the repeated characters in the entered expression or in entered cha..

Answer / hemalatha

import java.util.*;
class DupString
{
public static void main(String args[])
{
int i,j,len;
String s=new String();
Scanner sc=new Scanner(System.in);
System.out.println("Enter string");
s=sc.next();
len=s.length();
char[] s1=s.toCharArray();
for(i=0;i<len;i++)
{
for(j=i+1;j<len;j++)
{
if(s1[i]==s1[j])
{ if(s1[j]!='')
{
System.out.println(" "+s1[i]);
s1[j]='';
len--;
break;
}
}
}
}
}
}

Is This Answer Correct ?    0 Yes 0 No

To Write a C program to remove the repeated characters in the entered expression or in entered cha..

Answer / dave

void
rmdups(char *str)
{
char *sp;
for(sp = str; *sp; sp++)
{ char *lo, *hi;
for(lo = sp, hi=sp+1; *lo; hi++)
if(*hi != *sp)
*++lo = *hi;
}
}

Is This Answer Correct ?    4 Yes 5 No

To Write a C program to remove the repeated characters in the entered expression or in entered cha..

Answer / avinash

#include<stdio.h>
void main()
{int i,j,n;
char a[]="avinash";


for(i=0;i=5;i++)
{

for(j=i+1;j=6;j++)
{
if(a[i]==a[j])
{a[j]=a[j+1];}


}

for(n=0;n<7;n++)
{printf("%c",a[n]);}

}
}

Is This Answer Correct ?    0 Yes 1 No

To Write a C program to remove the repeated characters in the entered expression or in entered cha..

Answer / lijun li

#include <stdio.h>

main(int argc, char **argv)
{
int i;
char *source = argv[1];
char *dest;
char *temp;

unsigned int bitmap[8] = {0,0,0,0,0,0,0,0};
unsigned char c;
unsigned int mask;

dest = (char*)malloc(strlen(source));
temp = dest;

printf("before %s\n", source);
i=0;
while(source[i])
{
c = source[i];
mask = 1 << (c % 32);

if ((bitmap[c/32] & mask) == 0)
{
*temp++ = source[i];
bitmap[c/32] |= mask;
}
i++;
}

*temp = '\0';

printf("after %s\n", dest);
}

Is This Answer Correct ?    15 Yes 22 No

To Write a C program to remove the repeated characters in the entered expression or in entered cha..

Answer / guest

#include <iostream.h>
int main()
{
char str[10],str1[10];
int i;
cout<<"enter the string";
cin>>str[];
for (i = 0;i<9;i++)
{
if (str[i] != str[i+1])
str1[i]=str[i];
}
cout<<str1[];
return 0;
}

Is This Answer Correct ?    8 Yes 28 No

Post New Answer



More C Code Interview Questions

void main() { static int i=5; if(--i){ main(); printf("%d ",i); } }

1 Answers  


C program to print magic square of order n where n > 3 and n is odd

2 Answers   Accenture,


What is the problem with the following code segment? while ((fgets(receiving array,50,file_ptr)) != EOF) ;

1 Answers  


void main () { int x = 10; printf ("x = %d, y = %d", x,--x++); } a. 10, 10 b. 10, 9 c. 10, 11 d. none of the above

2 Answers   HCL,


#include<stdio.h> main() { struct xx { int x; struct yy { char s; struct xx *p; }; struct yy *q; }; }

1 Answers  






create a C-code that will display the total fare of a passenger of a taxi if the driver press enter,the timer will stop. Every 10 counts is 2 pesos. Initial value is 25.00

0 Answers   Microsoft,


Write a C program to print ‘Campus Force training’ without using even a single semicolon in the program.

3 Answers   Wipro,


char *someFun1() { char temp[ ] = “string"; return temp; } char *someFun2() { char temp[ ] = {‘s’, ‘t’,’r’,’i’,’n’,’g’}; return temp; } int main() { puts(someFun1()); puts(someFun2()); }

2 Answers  


write a c program to input initial & final time in the format hh:mm and find the time intervel between them? Ex inputs are initial 06:30 final 00:05 and 23:22 final 22.30

0 Answers  


main() { int i=300; char *ptr = &i; *++ptr=2; printf("%d",i); }

4 Answers   CSC,


# include<stdio.h> aaa() { printf("hi"); } bbb(){ printf("hello"); } ccc(){ printf("bye"); } main() { int (*ptr[3])(); ptr[0]=aaa; ptr[1]=bbb; ptr[2]=ccc; ptr[2](); }

1 Answers  


Write a single line c expression to delete a,b,c from aabbcc

2 Answers   Microsoft,






Categories