fork download
  1. #include<stdio.h>
  2. #include <ctype.h>
  3. int main()
  4. {
  5. char str[]={'a','1','b','2','c','3','d','4'};
  6. int i=0;
  7. int j=7;
  8. while ( i <= j )
  9. {
  10.  
  11. while ( str[i] >= 'a' && str[i] <= 'z' ) i++;
  12.  
  13. while( str[j] >= '1' && str[j] <= '9' ) j--;
  14.  
  15. char temp = str[i];
  16. str[i] = str[j];
  17. str[j] = temp;
  18.  
  19. i++; j--;
  20. }
  21.  
  22. printf("%c",str[0]);
  23. printf("%c",str[1]);
  24. printf("%c",str[2]);
  25. printf("%c",str[3]);
  26. printf("%c",str[4]);
  27. printf("%c",str[5]);
  28. printf("%c",str[6]);
  29. printf("%c",str[7]);
  30. return 0;
  31. }
Success #stdin #stdout 0.01s 1676KB
stdin
Standard input is empty
stdout
adbc2314