Advertisement
llvlleo1810

Tách từng kí tự trong một chuỗi theo thứ tự đảo ngược

Aug 7th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.30 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main()
  5. {
  6.     char a[100],b[100];
  7.     int i,n;
  8.     gets(a);
  9.     n=strlen(a);
  10.     for (i=0;i<n;i++)//dao nguoc chuoi
  11.         b[n-i-1]=a[i];
  12.     for (i=0;i<n;i++)
  13.     {
  14.         if (b[i]!=' ')
  15.             printf("%c ",b[i]);
  16.     }
  17.     return 0;  
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement