/*
判断是否为对称数,(0~10不属于)将输入整数反转后,再与原来的数对比
*/
#include <iostream>
#include <math.h>
#include <stdlib.h>
#include <string.h> //别漏
#include <string> //别漏
#include <algorithm> //transform函数来自这里
#include <stdio.h>
using namespace std;
int main()
{
int n;
while(cin>>n){
if(n<=10)
{
cout<<"no"<<endl;
}
else //反转处理
{
int n1=n;
int n2=0; //必须的
while(n!=0)
{
n2*=10; //进位操作,首次不进位
n2+=n%10;
n/=10;
}
if(n1==n2) cout<<"yes"<<endl;
else cout<<"no"<<endl;
}
}
}
判断对称整数
最新推荐文章于 2024-04-09 20:33:08 发布