C语言 · 字符串逆序

算法训练 字符串逆序  
时间限制:1.0s   内存限制:512.0MB
    
  输入一个字符串,长度在100以内,按相反次序输出其中的所有字符。
样例输入
tsinghua
样例输出
auhgnist
 
1 #include<stdio.h>
2 #include<string.h>
3 int main(){
4     char s[100];
5     scanf("%s",&s);
6     for(int i=strlen(s);i>=0;i--){
7         printf("%c",s[i]);
8     }
9 }

 

posted @ 2017-01-18 17:12  人间烟火地三鲜  阅读(417)  评论(0编辑  收藏  举报