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 C program where input is: "My name is xyz". output is: "xyz is name My".
class foo { public: static int func(const char*& p) const; }; This is illegal, why?
Why do u use # before include in a C Progam?
Write a program to input the price of 1 burger and the number of burgers eaten by a group of friends .print the total amount to be paid by the group?
Give the output for the following program. #define STYLE1 char main() { typedef char STYLE2; STYLE1 x; STYLE2 y; clrscr(); x=255; y=255; printf("%d %d\n",x,y); }
how to find out the inorder successor of a node in a tree??
Why c is called free form language?
int a=1,b=2,c=3; printf("%d,%d",a,b,c); What is the output?
main() { clrscr(); } clrscr();
what is bitwise operator?
Write a program to generate prime factors of a given integer?
What are the types of macro formats?