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



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

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

Post New Answer

More C Interview Questions

How do I access command-line arguments?

2 Answers   Bosch, Wipro,


What are two dimensional arrays alternatively called as?

0 Answers  


How to print India by nested loop? I IN IND INDI INDIA

4 Answers   NIIT, Wipro,


What is openmp in c?

0 Answers  


What is difference between function overloading and operator overloading?

0 Answers  


What is ## preprocessor operator in c?

0 Answers  


Eight queens puzzle

0 Answers  


What is an identifier?

0 Answers  


Explain goto?

0 Answers  


what are the advantage of pointer variables? write a program to count the number of vowels and consonants in a given string

3 Answers  


what is the difference between while and do while?

2 Answers  


What does the error 'Null Pointer Assignment' mean and what causes this error?

0 Answers   TISL,


Categories