判断回文数字——纯数字做法

bool f(int x)
{
    int t = x, y = 0;
    while (t)
    {
        y = y * 10 + t % 10;
        t /= 10;
    }
    return x == y;
}

 

posted @ 2022-02-21 22:02  riz9  阅读(42)  评论(0编辑  收藏  举报