Code for Program to print entered word in an alphabetical order in C Programming
#include <stdio.h>
#include <conio.h>
#include <string.h>
void main()
{
char a[40],t;
int i,j;
clrscr();
printf("\n Enter the String :- ");
scanf("%s",a);
for(i=0;a[i]!='\0';i++)
{
for(j=i+1;a[j]!='\0';j++)
{
if(a[i]>a[j])
{
t=a[i];
a[i]=a[j];
a[j]=t;
}
}
}
printf("the alphabet wise is :- %s",a);
getch();
}
/*
******
OUTPUT
******
Enter the String : world
the alphabet wise is dlorw
*/