Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. #include<conio.h>
  2. #include<stdio.h>
  3. #include<string.h>
  4. char doixung(char s1[100])
  5. {
  6. int i;
  7. for(i=0; i< strlen(s1)/2; i++)
  8. {
  9. if(s1[i] != s1[strlen(s1)-1-i])
  10. {
  11. return 0;
  12. }
  13. }
  14. return 1;
  15. }
  16. int main()
  17. {
  18. char s1[100];
  19. printf("xin moi ban nhap chuoi\n");
  20. gets(s1);
  21. if(doixung(s1)==0)
  22. {
  23. printf("chuoi vua nhap khong phai chuoi doi xung\n");
  24. }
  25. if(doixung(s1)==1)
  26. {
  27. printf("chuoi vua nhap la chuoi doi xung\n");
  28. }
  29.  
  30. int i;
  31. for(i=strlen(s1); i> 0; i--)
  32. {
  33. printf(s1[i]);
  34. }
  35.  
  36. Return 0 ;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement