#include<stdio.h> #include<string.h> int main() { char str[100],ch; int i,j,k; printf("please input a string: "); scanf("%s",&str); k = strlen(str); for(i=0,j=k-1;i<k/2;i++,j--) { ch = str[i]; str[i] = str[j]; str[j] = ch; } printf("%s ",str); return 0; }
please input a string: HelloWorld dlroWolleH Press any key to continue