字符串-04. 字符串逆序

字符串-04. 字符串逆序(15)

时间限制
400 ms
内存限制
65536 kB
代码长度限制
8000 B
判题程序
Standard
作者
白洪欢(浙江大学)

输入一个字符串,对该字符串进行逆序,输出逆序后的字符串。

输入格式:

输入在一行中给出一个不超过80个字符长度的、以回车结束的非空字符串。

输出格式:

在一行中输出逆序后的字符串。

输入样例:
Hello World!
输出样例:
!dlroW olleH
 1 #include<stdio.h>
 2 #include<math.h>
 3 #include<stdlib.h>
 4 #include<string.h>
 5 int main()
 6 {
 7     char s[100];
 8     gets(s);
 9     for(int i = strlen(s) - 1; i >= 0; i--)
10         printf("%c", s[i]);
11     return 0;
12 }

 

posted @ 2015-01-21 22:33  Yomman  阅读(1019)  评论(0)    收藏  举报