Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write a c prog for removing duplicate character from an
array and sorting remaining elements using a single array

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why c is faster than c++?

1048


What is the difference between null pointer and wild pointer?

1205


What do you mean by a local block?

1092


if a is an integer variable, a=5/2; will return a value a) 2.5 b) 3 c) 2 d) 0

1956


What is the use of a semicolon (;) at the end of every program statement?

1520


Is stack a keyword in c?

1095


What does the && operator do in a program code?

1243


When should you use a type cast?

1133


What is the purpose of sprintf?

1144


What are the different types of linkage exist in c?

1035


When should the const modifier be used?

1122


Why is c faster?

1117


Are the variables argc and argv are local to main?

1324


Explain pointer. What are function pointers in C?

1089


What is this infamous null pointer, anyway?

1068