问题 F: 数组逆置 Codeup ContestID:100000580

题目链接http://codeup.cn/problem.php?cid=100000580&pid=5

题目描述
输入一个字符串,长度小于等于200,然后将数组逆置输出。

输入
测试数据有多组,每组输入一个字符串。

输出
对于每组输入,请输出逆置后的结果。

样例输入
tianqin

样例输出
niqnait

代码

#include<stdio.h>
#include<string.h>

int main() {
	char a[210];
	while(gets(a)) {
		int len = strlen(a);
		for(int i = len - 1; i >=0; i--) {
			printf("%c", a[i]);
		}
		printf("\n");
	}
}
发布了97 篇原创文章 · 获赞 7 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/Rhao999/article/details/104054266
今日推荐