/* http://native-code.blogspot.com */ #include<stdio.h> #include<conio.h> #include<string.h> void main() { char a[20]; int i,j,k; clrscr(); printf(" /* http://native-code.blogspot.com */ \n\nEnter a String:"); gets(a); printf("\nThe string in alphabetical order is\n"); for(i=0;a[i]!='\0';i++) { j=i; for(k=i+1;a[k]!='\0';k++) { if(a[k]<a[j]) j=k; } k=a[i]; a[i]=a[j]; a[j]=(char)k; printf("%c",a[i]); } getch(); } /* http://native-code.blogspot.com */
Post a Comment