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 |
how can i make a program with this kind of output.. Enter a number: 5 0 01 012 0123 01234 012345 01234 0123 012 01 0
How do you search data in a data file using random access method?
wat are the two methods for swapping two numbers without using temp variable??
what are bps & baud rates? differentiate these two?
what wud be the output? main() { char *str[]={ "MANISH" "KUMAR" "CHOUDHARY" }; printf("\nstring1=%s",str[0]); printf("\nstring2=%s",str[1]); printf("\nstring3=%s",str[2]); a)string1=Manish string2=Kumar string3=Choudhary b)string1=Manish string2=Manish string3=Manish c)string1=Manish Kumar Choudhary string2=(null) string3=(null) d)Compiler error
any string of bits of length 'n' represents a unique non- negative integer between.............?
a simple c program using 'for' loop to display the output 5 4 3 2 1
What is Function Pointer? Explain with example?
How can you increase the size of a dynamically allocated array?
What is meant by int main ()?
Write a program or provide a pseudo code to flip the 2nd bit of the 32 bit number ! (Phone Screen)
If we give two names then this displays the connection between the two people. It is nothing but flames game