#include<stdio.h>
#include<string.h>
int main()
{
    int i,j,n;
    char a[20][30],b[30];
    printf("\n\tSorting Names.");
    printf("\n\t-------------");
    printf("\nHow many names your want to enter : ");
    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\nThe Names in Alphabetical Order...\n");
    for(i=0;i<n;i++)
     {
      printf("\n%d. %s",i+1,a[i]);
     }
    return 0;
}

Embed on website

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