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

What are the application of void data type in c?

1132


How can I list all of the predefined identifiers?

927


Write a program in "C" to calculate the root of a quadratic equation ax^2+bx+c=0, where the value of a,b & c are known.

2165


What is page thrashing?

1026


What is pragma c?

1059


Write a programme using structure that create a record of students. The user allow to add a record and delete a record and also show the records in ascending order.

2038


Subtract Two Number Without Using Subtraction Operator

780


One of the Institutes contains 5 student groups. Every group contains 4 students. Institute wants to store student group’s details in array. Group should contain group member’s details (name and registration number and age), project name, and mark of the group.

2582


Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.

1070


Can an array be an Ivalue?

1053


What is typedef struct in c?

997


Write a code to achieve inter processor communication (mutual exclusion implementation pseudo code)?

1073


What is meant by inheritance?

1047


what do you mean by enumeration constant?

955


write a c program in such a way that if we enter the today date the output should be next day's date.

2134