C语言 | Leetcode C语言题解之第9题回文数

题目:

题解:

cpp 复制代码
bool isPalindrome(int x) {
    if(x < 0)
        return false;
    long int sum=0;
    long int n=x;
    while(n!=0)
    {
        sum=sum*10+n%10;
        n=n/10;
    }
    if(sum==x)
    return true;
    else
    return false;
}
相关推荐
boxiansheng1631 小时前
通讯录系统报错(二)
c语言·数据结构
luj_176810 小时前
大律师考核应重能力与科技素养
c语言·开发语言·c++·经验分享·算法
刃神太酷啦11 小时前
Linux 系统 MySQL 完整安装配置教程:从卸载 MariaDB 到优化 my.cnf----《Hello MySQL!》(1)
android·linux·c语言·c++·mysql·leetcode·mariadb
萌动的小火苗12 小时前
数据结构面试题【无答案】
c语言·开发语言·数据结构·链表
水饺编程15 小时前
第5章,[Win32 章节] :Polygon 函数和多边形填充模式
c语言·c++·windows·visual studio
wuminyu15 小时前
Java FFM处理网络读写事件源码剖析
java·linux·c语言·jvm·c++
wenyq715 小时前
LeetCode 2904. Shortest and Lexicographically Smallest Beautiful String
算法·leetcode
一木 之林16 小时前
C/C++ 面向对象编程(OOP)(进阶)
java·c语言·c++
LONGZETECH17 小时前
新能源汽车动力电池实训教学痛点与虚拟仿真技术解决方案
c语言·3d·unity·架构·汽车·汽车教学软件
_Narcissus_18 小时前
分治&递归
数据结构·c++·笔记·算法·leetcode·递归·分治