Program:
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,temp,b;
char *anb,a[30];
clrscr();
printf("Enter the string:");
scanf("%s",anb);
printf("\nString:%s",anb);
for(i=0;(*anb)!=NULL;*(++anb))
{
a[i]=*anb;
i++;
}
a[i]=NULL;
printf("\nShow:%s",a);
j=i--;
for(b=0;b<=j;b++)
for(i=0;i<=j;i++)
{
if(a[i]>a[i+1])
a[i]=a[i];
else
{
temp=a[i];
a[i]=a[i+1];
a[i+1]=temp;
}
}
a[--i]=NULL;
printf("\nOutput:%s",a);
getch();
}
Sample Output:
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,temp,b;
char *anb,a[30];
clrscr();
printf("Enter the string:");
scanf("%s",anb);
printf("\nString:%s",anb);
for(i=0;(*anb)!=NULL;*(++anb))
{
a[i]=*anb;
i++;
}
a[i]=NULL;
printf("\nShow:%s",a);
j=i--;
for(b=0;b<=j;b++)
for(i=0;i<=j;i++)
{
if(a[i]>a[i+1])
a[i]=a[i];
else
{
temp=a[i];
a[i]=a[i+1];
a[i+1]=temp;
}
}
a[--i]=NULL;
printf("\nOutput:%s",a);
getch();
}
Sample Output:
No comments:
Post a Comment
Let Us hear Your thoughts about this Post.. Its Our Pleasure to get your feedback..