题解 | #整数的十位#

整数的十位

https://www.nowcoder.com/practice/031db23916904f4fad72198fe491b47b

#include <iostream>
#include <string>
using namespace std;

int main() {
    int a;
    cin>>a;
    string b = to_string(a);
    cout<<b[b.length()-2];
}
// 64 位输出请用 printf("%lld")

取一个数字的某个位置的数字也可以使用string来做

全部评论

相关推荐

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

创作者周榜

更多
牛客网
牛客企业服务