题解 | #数字颠倒#

数字颠倒

http://www.nowcoder.com/practice/ae809795fca34687a48b172186e3dafe

//不换行的输入用getchar,换行的输入用scanf
#include<stdio.h>
#include<string.h>
#define SIZE 100000
int main()
{
    char ch;
    char a[SIZE];
    int i = 0,j = 0;
    while((ch = getchar()) != '\n'){        //把数字存在字符串里
        a[i] = ch;
        i++; 
    }
//倒着遍历去输出
    for(j = i - 1;j>=0;j--){
        printf("%c",a[j]);
    }
    return 0;
}
全部评论

相关推荐

06-26 15:33
青岛工学院 Java
积极的秋田犬要冲国企:他现在邀请我明天面试
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务