#include<stdio.h> #include<string.h> int main() { char str[100],ch; int i,j,k; printf("please input a string:\n"); 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\n",str); return 0; }
please input a string: HelloWorld dlroWolleH Press any key to continue
版权声明:本文为博主原创文章,未经博主允许不得转载。
时间: 2024-12-12 06:33:45