Search This Blog

Translate

c program to read a set of names and arrange them in ascending order

c program to read a set of names and arrange them in ascending order,c program to arrange numbers in ascending order,c program to arrange numbers in ascending order without using array,c program to arrange numbers in ascending order using pointers,c program to arrange numbers in descending order

MCA Management Solved Question

University of pune

C programming Language

____________________________________________________

 C Program to Accept Emplyee name from user and arrange them ascending order


C Program to Accept student name from user and arrange them ascending order

c program to read a set of names and arrange them in ascending order
 

#include
void main()
{
int i,j,n;
char str[20][20],temp[20];

puts("Enter the no. of string to be sorted");
scanf("%d",&n);

for(i=0;i<=n;i++)
gets(str[i]);

for(i=0;i<=n;i++)
for(j=i+1;j<=n;j++)
{
  if(strcmp(str[i],str[j])>0)
   {
      strcpy(temp,str[i]);
      strcpy(str[i],str[j]);
     strcpy(str[j],temp);
`}
}
printf("The sorted string\n");

for(i=0;i<=n;i++)
puts(str[i]);

}

c program to read a set of names and arrange them in ascending order, c program to arrange numbers in ascending order,c program to arrange numbers in ascending order without using array,c program to arrange numbers in ascending order using pointers,c program to arrange numbers in descending order




C Program example List

Google+ Badge