题解 | #进制转换#

进制转换

https://www.nowcoder.com/practice/8f3df50d2b9043208c5eed283d1d4da6

#include <stdio.h>

int main() {
    char hexString[20]; // Assuming maximum length of input is 20 characters
    while (scanf("%s", hexString) != EOF) { // Keep reading input until end of file
        unsigned int decimalValue;
        sscanf(hexString, "%x", &decimalValue); // Convert hexadecimal input to decimal
        printf("%u\n", decimalValue); // Print decimal output
    }
    return 0;
}

全部评论

相关推荐

点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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