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 many times does the loop iterated ? for (i=0;i=10;i+=2) printf("Hi\n");
#include<stdio.h> void main() { int a,b,c; a=b=c=1; c=++a || ++b && ++c; printf("%d\t%d\t%d",a,b,c); }
int i[2], j; int *pi;i[0] = 1; i[1] = 5; pi = i; j = *pi + 1 + *(pi + 1)Value of j after execution of the above statements will be a) 7 b) 6 c) 4 d) pointer
What does %d do?
What is the explanation for the dangling pointer in c?
25. It takes five minutes to pass a rumour from one person to two other persons. The tree of rumour continues. Find how many minutes does it take spread the rumour to 768 persons. ?
11 Answers CTS, TCS,
pierrot's divisor program using c or c++ code
Describe dynamic data structure in c programming language?
Determine the result of performing two successive block transfers into the same area of a frame buffer using the binary arith operations
How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?
2 Answers Aricent, Manipal University,
main() { int i=0; while(+(+i--)!=0) i-=i++; printf(i); }
Why void is used in c?