Advertisement
huutho_96

xóa khoản trắng

Dec 23rd, 2014
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1.  
  2. #include <stdio.h>
  3. #include <string.h>
  4.  
  5. void main()
  6. {
  7. int i;
  8. char ten[31];
  9. gets_s(ten);
  10. while (ten[0] == ' ') for (i = 0; i < strlen(ten); i++) ten[i] = ten[i + 1];
  11. while (ten[strlen(ten) - 1] == ' ') ten[strlen(ten) - 1] = '\0';
  12. for (i = 0; i < strlen(ten); i++) if (ten[i] == ' ') while (ten[i + 1] == ' ') for (int j = i; j < strlen(ten); j++) ten[j] = ten[j + 1];
  13. puts(ten);
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement