write a c prog for removing duplicate character from an
array and sorting remaining elements using a single array
Answer / b sohan lal
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char s[15],a[15];
int i,j,n;
clrscr();
printf("enter the string");
scanf("%s",s);
for(i=0;s[i]!='\0';i++)
{
if(s[i]!=s[i+1])
a[i]=s[i];
}
n=strlen(a);
for(i=0;s[i]!='\0';i++)
{
for(j=0;j<=n-i-1;j++)
{
if(a[j]>=a[j+1])
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
}
printf("the sorted string is:%s",a);
getch();
}
| Is This Answer Correct ? | 2 Yes | 2 No |
Write a function to find the area of a triangle whose length of three sides is given
What are the two types of functions in c?
What is the stack in c?
What are reserved words?
A array contains dissimilar element how can we count, and A array contains dissimilar element how can we store in another array with out repetition.
What is the correct code to have following output in c using nested for loop?
write a program to search for an element in a given array. If the array was found then display its position otherwise display appropriate message in c language
What is sizeof array?
What are void pointers in c?
While(1) { } when this loop get terminate is it a infinite loop?
Define macros.
write a c program to accept a given integer value and print its value in words
4 Answers Vernalis, Vernalis Systems,