Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int main()
- {
- char a[10][50], temp[50];
- int i, j;
- for(i=0;i<10;i++)
- {
- fgets(a[i], 49, stdin);
- }
- for(i=0;i<10;i++)
- {
- for(j=0;j<10-1;j++)
- {
- if((strcmp(a[j], a[j+1]))>0)
- {
- strcpy(temp, a[j]);
- strcpy(a[j], a[j+1]);
- strcpy(a[j+1], temp);
- }
- }
- }
- printf("\n");
- for(i=0;i<10;i++)
- {
- printf("%s", a[i]);
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment