题解 | #牛牛逆序输出#

牛牛逆序输出

https://www.nowcoder.com/practice/d981181ce18e4cce945fdf52daf037a1

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

int main() {
    // char* str = malloc(sizeof(char) * 1);
    // scanf("%s", str);

    // for (int i = strlen(str) - 1; i >= 0; i--) {
    //     printf("%c", str[i]);
    // }
    int n;
    scanf("%d", &n);
    while (n) {
        printf("%d", n % 10);
        n /= 10;
    } 

    return 0;
}

全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务