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