to remove the repeated cahracter from the given caracter
array.
i.e..,
if the input is SSAD
output should of
SAD
Answers were Sorted based on User's Feedback
Answer / vijay
#include<stdio.h>
main()
{
char arr[]="ssadddvhdfgiweuonbbnxjcusdfssd";
int i=0,j,k;
printf("Before string is %s \n",arr);
while(arr[i]!=0)
{
for(j=i+1;arr[j]!=0;j++)
{
if(arr[i]==arr[j])
{
for(k=j;arr[k]!=0;k++)
arr[k]=arr[k+1];
arr[k]='\0';
j--;
}
}
i++;
}
printf("After string is %s \n",arr);
}
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / krishna
#include<stdio.h>
void main()
{
char arr[]="aaadddssdsejskld";
int char_check=0;
int i,j;
char c;
clrscr();
while(arr[char_check])
{
c=arr[char_check];
i=j=char_check+1;
while(arr[i])
{
if(arr[i]!=c)
{
arr[j]=arr[i];
j++;
}
i++;
} arr[j]='\0';
char_check++;
}
for(i=0;arr[i]!='\0';i++)
printf (" \n%c\n " ,arr[i]);
}
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / krishna
#include<stdio.h>
void main()
{
char arr[]="aaadddssdsejskld";
int char_check=0;
int i,j;
char c;
clrscr();
while(arr[char_check])
{
c=arr[char_check];
i=j=char_check+1;
while(arr[i])
{
if(arr[i]!=c)
{
arr[j]=arr[i];
j++;
}
i++;
} arr[j]='\0';
char_check++;
}
for(i=0;arr[i]!='\0';i++)
printf (" \n%c\n " ,arr[i]);
}
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / welkin
#include<stdio.h>
int main()
{
int i=0,j,x=-1;
char str[10],temp,temp1,buff[10];
printf("\nEnter the string ");
scanf("%s",str);
while((temp=str[i])!=NULL)
{
for(j=0;j<=x;j++)
{
temp1=buff[j];
if(temp==temp1)
{
break;
}
}
if(j>x)
buff[++x]=temp;
i++;
}
buff[++x]='\0';
printf("\n%s",buff);
return 0;
}
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / mohanraja
string s,str;
s = string.Empty;
str = this.txtString.Text;
foreach (char c in str)
{
if (s.IndexOf(c) == -1)
{
s = s + c.ToString();
}
}
this.label1.Text = s;
Is This Answer Correct ? | 0 Yes | 2 No |
#define SQR(x) x * x main() { printf("%d", 225/SQR(15)); } a. 1 b. 225 c. 15 d. none of the above
How we will connect multiple client ? (without using fork,thread)
main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); }
void main() { if(~0 == (unsigned int)-1) printf(“You can answer this if you know how values are represented in memory”); }
main() { char *a = "Hello "; char *b = "World"; clrscr(); printf("%s", strcat(a,b)); } a. Hello b. Hello World c. HelloWorld d. None of the above
can u give me the c codings for converting a string into the hexa decimal form......
How to reverse a String without using C functions ?
33 Answers Matrix, TCS, Wipro,
main() { int i=5,j=10; i=i&=j&&10; printf("%d %d",i,j); }
what is variable length argument list?
void main() { char ch; for(ch=0;ch<=127;ch++) printf(“%c %d \n“, ch, ch); }
main() { int i=10; i=!i>14; Printf ("i=%d",i); }
what is oop?