SHARE
TWEET

Untitled

a guest May 21st, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. int main(){
  3. char name[12] = {NULL};
  4. char sortedname[12] = {NULL};
  5. printf("please enter your name: \n");
  6. scanf("%s", &name[0]);
  7. printf("your name is: %s\n", name);
  8. for (int i = 0 ; i <= 12 ; i++)
  9. {
  10. if (name[i] > name[i + 1])
  11. {
  12. sortedname[0] = name[1];
  13. sortedname[1] = name[0];
  14. }
  15. // sortedname[12] = i;
  16. }
  17. printf("The sorted name is: \n%s", sortedname);
  18. return 0;
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top