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 |
to remove the repeated cahracter from the given caracter array. i.e.., if the input is SSAD output should of SAD
Write a C program to add two numbers before the main function is called.
how to check whether a linked list is circular.
Cluster head selection in Wireless Sensor Network using C programming language.
Finding a number multiplication of 8 with out using arithmetic operator
#include <stdio.h> main() { char * str = "hello"; char * ptr = str; char least = 127; while (*ptr++) least = (*ptr<least ) ?*ptr :least; printf("%d",least); }
4. Main() { Int i=3,j=2,c=0,m; m=i&&j||c&I; printf(“%d%d%d%d”,I,j,c,m); }
#include<conio.h> main() { int x,y=2,z,a; if(x=y%2) z=2; a=2; printf("%d %d ",z,x); }
void main() { int k=ret(sizeof(float)); printf("\n here value is %d",++k); } int ret(int ret) { ret += 2.5; return(ret); }
What is the hidden bug with the following statement? assert(val++ != 0);
main() { int i=5; printf(ā%dā,i=++i ==6); }
Write a routine that prints out a 2-D array in spiral order