#include<stdio.h>
#include<string.h>
void main()
{
int i,j,n;
char a[20][30],b[30];
printf("\n\tSORTING THE NAMES");
printf("\nEnter the no. of names:");
scanf("%d",&n);
printf("\n");
 for(i=0;i<n;i++)
 {
 printf("\nEnter the name%d:",i+1);
 scanf("%s",a[i]);
 }
 for(i=0;i<n;i++)
 {
 for(j=i+1;j<n;j++)
 {
 if(strcmp(a[i],a[j])>0)
 {
 strcpy(b,a[j]);
 strcpy(a[j],a[i]);
 strcpy(a[i],b);
 }
 }
 }
 printf("\n\nAlphabetical order:\n");
 for(i=0;i<n;i++)
  printf("\n%d.%s",i+1,a[i]);
 }






Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: